44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
TEST(@"+[sha1Hash]", (sha1 = [OFSHA1Hash SHA1Hash]))
while (![f isAtEndOfStream]) {
char buf[64];
size_t len = [f readNBytes: 64
intoBuffer: buf];
[sha1 updateWithBuffer: buf
ofSize: len];
}
[f close];
TEST(@"-[digest]",
!memcmp([sha1 digest], testfile_sha1, OF_SHA1_DIGEST_SIZE))
EXPECT_EXCEPTION(@"Detect invalid call of -[updateWithBuffer]",
OFHashAlreadyCalculatedException, [sha1 updateWithBuffer: ""
ofSize: 1])
[pool drain];
}
@end
|
|
|
>
|
|
|
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
TEST(@"+[sha1Hash]", (sha1 = [OFSHA1Hash SHA1Hash]))
while (![f isAtEndOfStream]) {
char buf[64];
size_t len = [f readNBytes: 64
intoBuffer: buf];
[sha1 updateWithBuffer: buf
length: len];
}
[f close];
TEST(@"-[digest]",
!memcmp([sha1 digest], testfile_sha1, OF_SHA1_DIGEST_SIZE))
EXPECT_EXCEPTION(@"Detect invalid call of "
@"-[updateWithBuffer:length:]", OFHashAlreadyCalculatedException,
[sha1 updateWithBuffer: ""
length: 1])
[pool drain];
}
@end
|