21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
static OFString *module;
@implementation TestsAppDelegate (OFASN1DEREncodedValueTests)
- (void)ASN1DEREncodedValueTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
module = @"OFASN1Boolean";
TEST(@"-[DEREncodedValue]",
[[[OFASN1Boolean booleanWithBooleanValue: false] DEREncodedValue]
isEqual: [OFData dataWithItems: "\x01\x01\x00"
count: 3]] &&
[[[OFASN1Boolean booleanWithBooleanValue: true] DEREncodedValue]
isEqual: [OFData dataWithItems: "\x01\x01\xFF"
count: 3]])
[pool drain];
}
@end
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
static OFString *module;
@implementation TestsAppDelegate (OFASN1DEREncodedValueTests)
- (void)ASN1DEREncodedValueTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFData *data;
module = @"OFASN1BitString";
TEST(@"-[DEREncodedValue]",
(data = [OFData dataWithItems: "\xFF\x00\xF8"
count: 3]) &&
[[[OFASN1BitString bitStringWithBitStringValue: data
bitStringLength: 20] DEREncodedValue]
isEqual: [OFData dataWithItems: "\x03\x04\x04\xFF\x00\xF8"
count: 6]] &&
(data = [OFData dataWithItems: "abcdefäöü"
count: 12]) &&
[[[OFASN1BitString bitStringWithBitStringValue: data
bitStringLength: 12 * 8]
DEREncodedValue] isEqual:
[OFData dataWithItems: "\x03\x0D\x00" "abcdefäöü"
count: 15]] &&
(data = [OFData dataWithItems: ""
count: 0]) &&
[[[OFASN1BitString bitStringWithBitStringValue: data
bitStringLength: 0] DEREncodedValue]
isEqual: [OFData dataWithItems: "\x03\x01\x00"
count: 3]])
module = @"OFASN1Boolean";
TEST(@"-[DEREncodedValue]",
[[[OFASN1Boolean booleanWithBooleanValue: false] DEREncodedValue]
isEqual: [OFData dataWithItems: "\x01\x01\x00"
count: 3]] &&
[[[OFASN1Boolean booleanWithBooleanValue: true] DEREncodedValue]
isEqual: [OFData dataWithItems: "\x01\x01\xFF"
count: 3]])
[pool drain];
}
@end
|