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