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