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