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.
		
		
		
		
		
			
		
			
	
	
		
			42 lines
		
	
	
		
			1003 B
		
	
	
	
		
			Matlab
		
	
		
		
			
		
	
	
			42 lines
		
	
	
		
			1003 B
		
	
	
	
		
			Matlab
		
	
| 
											8 years ago
										 | // | ||
|  | //  Copyright (c) 2018 Open Whisper Systems. All rights reserved. | ||
|  | // | ||
|  | 
 | ||
|  | #import "OWSSignalServiceProtos.pb.h" | ||
|  | #import <XCTest/XCTest.h> | ||
|  | 
 | ||
|  | @interface ProtoParsingTest : XCTestCase | ||
|  | 
 | ||
|  | @end | ||
|  | 
 | ||
|  | #pragma mark - | ||
|  | 
 | ||
|  | @implementation ProtoParsingTest | ||
|  | 
 | ||
|  | - (void)testProtoParsing_nil | ||
|  | { | ||
|  |     OWSSignalServiceProtosEnvelope *_Nullable envelope = [OWSSignalServiceProtosEnvelope parseFromData:nil]; | ||
|  |     XCTAssertNotNil(envelope); | ||
|  | } | ||
|  | 
 | ||
|  | - (void)testProtoParsing_empty | ||
|  | { | ||
|  |     NSData *data = [NSData new]; | ||
|  |     OWSSignalServiceProtosEnvelope *_Nullable envelope = [OWSSignalServiceProtosEnvelope parseFromData:data]; | ||
|  |     XCTAssertNotNil(envelope); | ||
|  | } | ||
|  | 
 | ||
|  | - (void)testProtoParsing_wrong1 | ||
|  | { | ||
|  |     @try { | ||
|  |         NSData *data = [@"test" dataUsingEncoding:NSUTF8StringEncoding]; | ||
|  |         [OWSSignalServiceProtosEnvelope parseFromData:data]; | ||
|  |         XCTFail(@"Missing expected exception"); | ||
|  |     } @catch (NSException *exception) { | ||
|  |         // Exception is expected. | ||
|  |         NSLog(@"Caught expected exception: %@", [exception class]); | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | @end |