25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#import "OFHashAlreadyCalculatedException.h"
#import "TestsAppDelegate.h"
static OFString *module = @"OFMD5Hash";
const uint8_t testfile_md5[OF_MD5_DIGEST_SIZE] =
"\x00\x8B\x9D\x1B\x58\xDF\xF8\xFE\xEE\xF3\xAE\x8D\xBB\x68\x2D\x38";
@implementation TestsAppDelegate (OFMD5HashTests)
- (void)MD5HashTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFMD5Hash *md5;
|
|
|
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#import "OFHashAlreadyCalculatedException.h"
#import "TestsAppDelegate.h"
static OFString *module = @"OFMD5Hash";
const uint8_t testfile_md5[16] =
"\x00\x8B\x9D\x1B\x58\xDF\xF8\xFE\xEE\xF3\xAE\x8D\xBB\x68\x2D\x38";
@implementation TestsAppDelegate (OFMD5HashTests)
- (void)MD5HashTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFMD5Hash *md5;
|
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
size_t len = [f readIntoBuffer: buf
length: 64];
[md5 updateWithBuffer: buf
length: len];
}
[f close];
TEST(@"-[digest]",
!memcmp([md5 digest], testfile_md5, OF_MD5_DIGEST_SIZE))
EXPECT_EXCEPTION(@"Detect invalid call of "
@"-[updateWithBuffer:length]", OFHashAlreadyCalculatedException,
[md5 updateWithBuffer: ""
length: 1])
[pool drain];
}
@end
|
|
<
|
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
size_t len = [f readIntoBuffer: buf
length: 64];
[md5 updateWithBuffer: buf
length: len];
}
[f close];
TEST(@"-[digest]", !memcmp([md5 digest], testfile_md5, 16))
EXPECT_EXCEPTION(@"Detect invalid call of "
@"-[updateWithBuffer:length]", OFHashAlreadyCalculatedException,
[md5 updateWithBuffer: ""
length: 1])
[pool drain];
}
@end
|