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.
		
		
		
		
		
			
		
			
	
	
		
			36 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Matlab
		
	
		
		
			
		
	
	
			36 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Matlab
		
	
| 
											12 years ago
										 | #import "SpeexCodecTest.h" | ||
|  | #import "SpeexCodec.h" | ||
|  | #import "TestUtil.h" | ||
|  | #import "Util.h" | ||
|  | 
 | ||
|  | @implementation SpeexCodecTest | ||
|  | -(void) testSpeexConstantBitRate { | ||
|  |     NSMutableData* x1 = [NSMutableData dataWithLength:320]; | ||
|  |     NSMutableData* x2 = [NSMutableData dataWithLength:320]; | ||
|  |     for (NSUInteger i = 0; i < [x2 length]; i++) { | ||
|  |         [x2 setUint8At:i to:(uint8_t)(i & 255)]; | ||
|  |     } | ||
|  | 
 | ||
|  |     SpeexCodec* c = [SpeexCodec speexCodec]; | ||
|  |     NSData* e100 = [c encode:x1]; | ||
|  |     NSData* e200 = [c encode:x2]; | ||
|  |     test([e200 length] == [e100 length]); | ||
|  | } | ||
|  | 
 | ||
|  | -(void) testSpeexRoundTripMaintainsLength { | ||
|  |     NSMutableData* x1 = [NSMutableData dataWithLength:320]; | ||
|  |     NSMutableData* x2 = [NSMutableData dataWithLength:320]; | ||
|  |     for (NSUInteger i = 0; i < [x2 length]; i++) { | ||
|  |         [x2 setUint8At:i to:(uint8_t)(i & 255)]; | ||
|  |     } | ||
|  |      | ||
|  |     SpeexCodec* c = [SpeexCodec speexCodec]; | ||
|  |     NSData* e100 = [c encode:x1]; | ||
|  |     NSData* e200 = [c encode:x2]; | ||
|  |     NSData* d100 = [c decode:e100]; | ||
|  |     NSData* d200 = [c decode:e200]; | ||
|  |     test([d100 length] == [x1 length]); | ||
|  |     test([d200 length] == [x2 length]); | ||
|  | } | ||
|  | @end |