Skip to content

Commit

Permalink
ADDED: short and long deserialisation test
Browse files Browse the repository at this point in the history
  • Loading branch information
odrobnik authored and Oliver Drobnik committed Oct 7, 2015
1 parent 8ee181a commit 517d0a7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Test/Source/DTASN1SerializationTest.m
Expand Up @@ -58,6 +58,32 @@ - (void)testDecodingEmptySequence
XCTAssertTrue([object isKindOfClass:[NSArray class]], @"Decoded object should be an array");
}

- (void)testDecodingSimpleInt
{
NSMutableData *data = [NSMutableData new];
uint8_t byte = 2;
[data appendBytes:&byte length:1];
byte = 1;
[data appendBytes:&byte length:1];
byte = 3;
[data appendBytes:&byte length:1];

NSNumber *object = [DTASN1Serialization objectWithData:data];
XCTAssertEqualObjects(object, @(3));
}

- (void)testDecodingLongInt
{
NSString *string = @"AgcDjX6mjTpM";
NSData *data = [DTBase64Coding dataByDecodingString:string];

NSNumber *object = [DTASN1Serialization objectWithData:data];

XCTAssertNotNil(object, @"Should be able to decode as number");
XCTAssertTrue([object isKindOfClass:[NSNumber class]], @"Decoded object should be a number");
XCTAssertEqualObjects(object, @(1000000029801036));
}

- (void)testCertificateDecoding
{
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"SelfSigned" ofType:@"der"];
Expand Down

0 comments on commit 517d0a7

Please sign in to comment.