@@ -37,11 +37,11 @@ @implementation TestsAppDelegate (SHA512HashTests) - (void)SHA512HashTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; - OFSHA512Hash *sha512; + OFSHA512Hash *sha512, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"rb"]; TEST(@"+[cryptoHash]", (sha512 = [OFSHA512Hash cryptoHash])) @@ -52,15 +52,19 @@ [sha512 updateWithBuffer: buf length: len]; } [f close]; - TEST(@"-[digest]", !memcmp([sha512 digest], testfile_sha512, 64)) + TEST(@"-[copy]", (copy = [[sha512 copy] autorelease])) + + TEST(@"-[digest]", + memcmp([sha512 digest], testfile_sha512, 64) == 0 && + memcmp([copy digest], testfile_sha512, 64) == 0) EXPECT_EXCEPTION(@"Detect invalid call of " @"-[updateWithBuffer:length:]", OFHashAlreadyCalculatedException, [sha512 updateWithBuffer: "" length: 1]) [pool drain]; } @end