@@ -1,7 +1,7 @@ /* - * Copyright (c) 2008-2021 Jonathan Schleifer + * Copyright (c) 2008-2022 Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -30,11 +30,13 @@ @implementation TestsAppDelegate (SHA512HashTests) - (void)SHA512HashTests { void *pool = objc_autoreleasePoolPush(); OFSHA512Hash *SHA512, *SHA512Copy; - OFFile *file = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; + OFURL *URL = [OFURL URLWithString: @"objfw-embedded:///testfile.bin"]; + OFStream *file = [[OFURLHandler handlerForURL: URL] + openItemAtURL: URL mode: @"r"]; TEST(@"+[hashWithAllowsSwappableMemory:]", (SHA512 = [OFSHA512Hash hashWithAllowsSwappableMemory: true])) while (!file.atEndOfStream) { @@ -44,10 +46,13 @@ } [file close]; TEST(@"-[copy]", (SHA512Copy = [[SHA512 copy] autorelease])) + TEST(@"-[calculate]", + R([SHA512 calculate]) && R([SHA512Copy calculate])) + TEST(@"-[digest]", memcmp(SHA512.digest, testFileSHA512, 64) == 0 && memcmp(SHA512Copy.digest, testFileSHA512, 64) == 0) EXPECT_EXCEPTION(@"Detect invalid call of "