mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			22 lines
		
	
	
		
			736 B
		
	
	
	
		
			Matlab
		
	
		
		
			
		
	
	
			22 lines
		
	
	
		
			736 B
		
	
	
	
		
			Matlab
		
	
| 
								 
											12 years ago
										 
									 | 
							
								#import "EventWindowTest.h"
							 | 
						||
| 
								 | 
							
								#import "EventWindow.h"
							 | 
						||
| 
								 | 
							
								#import "TestUtil.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								@implementation EventWindowTest
							 | 
						||
| 
								 | 
							
								-(void) testEventWindow {
							 | 
						||
| 
								 | 
							
								    EventWindow* w = [EventWindow eventWindowWithWindowDuration:5];
							 | 
						||
| 
								 | 
							
								    test([w countAfterRemovingEventsBeforeWindowEndingAt:0] == 0);
							 | 
						||
| 
								 | 
							
								    [w addEventAtTime:4];
							 | 
						||
| 
								 | 
							
								    [w addEventAtTime:6];
							 | 
						||
| 
								 | 
							
								    [w addEventAtTime:8];
							 | 
						||
| 
								 | 
							
								    
							 | 
						||
| 
								 | 
							
								    test([w countAfterRemovingEventsBeforeWindowEndingAt:8] == 3);
							 | 
						||
| 
								 | 
							
								    test([w countAfterRemovingEventsBeforeWindowEndingAt:10] == 2);
							 | 
						||
| 
								 | 
							
								    test([w countAfterRemovingEventsBeforeWindowEndingAt:12] == 1);
							 | 
						||
| 
								 | 
							
								    test([w countAfterRemovingEventsBeforeWindowEndingAt:14] == 0);
							 | 
						||
| 
								 | 
							
								    
							 | 
						||
| 
								 | 
							
								    // going backwards not allowed
							 | 
						||
| 
								 | 
							
								    testThrows([w countAfterRemovingEventsBeforeWindowEndingAt:8]);
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								@end
							 |