@@ -34,11 +34,11 @@ @implementation TestsAppDelegate (OFMD5HashTests) - (void)MD5HashTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; - OFMD5Hash *md5; + OFMD5Hash *md5, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"rb"]; TEST(@"+[cryptoHash]", (md5 = [OFMD5Hash cryptoHash])) @@ -49,15 +49,19 @@ [md5 updateWithBuffer: buf length: len]; } [f close]; - TEST(@"-[digest]", !memcmp([md5 digest], testfile_md5, 16)) + TEST(@"-[copy]", (copy = [[md5 copy] autorelease])) + + TEST(@"-[digest]", + memcmp([md5 digest], testfile_md5, 16) == 0 && + memcmp([copy digest], testfile_md5, 16) == 0) EXPECT_EXCEPTION(@"Detect invalid call of " @"-[updateWithBuffer:length]", OFHashAlreadyCalculatedException, [md5 updateWithBuffer: "" length: 1]) [pool drain]; } @end