Overview
Comment: | Migrate OFHMACTests to ObjFWTest |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | objfwtest |
Files: | files | file ages | folders |
SHA3-256: |
e3fbb3ecea1d2cc6121ba4f4acd8a991 |
User & Date: | js on 2024-02-11 21:57:25 |
Other Links: | branch diff | manifest | tags |
Context
2024-02-11
| ||
22:01 | Migrate OFThreadTests to ObjFWTest check-in: b0901ee40e user: js tags: objfwtest | |
21:57 | Migrate OFHMACTests to ObjFWTest check-in: e3fbb3ecea user: js tags: objfwtest | |
21:46 | Migrate OFSubprocessTests to ObjFWTest check-in: 9c28411f49 user: js tags: objfwtest | |
Changes
Modified .fossil-settings/clean-glob from [cc4d98d92f] to [098609aeec].
︙ | ︙ | |||
48 49 50 51 52 53 54 | src/tls/libobjfwtls.* tests/DerivedData tests/EBOOT.PBP tests/Info.plist tests/PARAM.SFO tests/objc_sync/objc_sync tests/terminal/terminal_tests | < | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | src/tls/libobjfwtls.* tests/DerivedData tests/EBOOT.PBP tests/Info.plist tests/PARAM.SFO tests/objc_sync/objc_sync tests/terminal/terminal_tests tests/testfile_ini.m tests/tests tests/tests.3dsx tests/tests.arm9 tests/tests.nds tests/tests.nro tests/tests.rpx utils/objfw-config utils/objfw-new/objfw-new utils/ofarc/ofarc utils/ofdns/ofdns utils/ofhash/ofhash utils/ofhttp/ofhttp |
Modified .fossil-settings/ignore-glob from [1475b0f60e] to [4cd1f0fba2].
︙ | ︙ | |||
53 54 55 56 57 58 59 | tests/Info.plist tests/PARAM.SFO tests/iOS.xcodeproj/*.pbxuser tests/iOS.xcodeproj/project.xcworkspace tests/iOS.xcodeproj/xcuserdata tests/objc_sync/objc_sync tests/terminal/terminal_tests | < < | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | tests/Info.plist tests/PARAM.SFO tests/iOS.xcodeproj/*.pbxuser tests/iOS.xcodeproj/project.xcworkspace tests/iOS.xcodeproj/xcuserdata tests/objc_sync/objc_sync tests/terminal/terminal_tests tests/testfile_ini.m tests/tests tests/tests.3dsx tests/tests.arm9 tests/tests.nds tests/tests.nro tests/tests.rpx utils/objfw-config utils/objfw-new/objfw-new utils/ofarc/ofarc utils/ofdns/ofdns utils/ofhash/ofhash utils/ofhttp/ofhttp |
Modified .gitignore from [b086db5cd9] to [374523f65f].
︙ | ︙ | |||
53 54 55 56 57 58 59 | tests/Info.plist tests/PARAM.SFO tests/iOS.xcodeproj/*.pbxuser tests/iOS.xcodeproj/project.xcworkspace tests/iOS.xcodeproj/xcuserdata tests/objc_sync/objc_sync tests/terminal/terminal_tests | < | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | tests/Info.plist tests/PARAM.SFO tests/iOS.xcodeproj/*.pbxuser tests/iOS.xcodeproj/project.xcworkspace tests/iOS.xcodeproj/xcuserdata tests/objc_sync/objc_sync tests/terminal/terminal_tests tests/testfile_ini.m tests/tests tests/tests.3dsx tests/tests.arm9 tests/tests.nds tests/tests.nro tests/tests.rpx utils/objfw-config utils/objfw-new/objfw-new utils/ofarc/ofarc utils/ofdns/ofdns utils/ofhash/ofhash utils/ofhttp/ofhttp |
Modified new_tests/Makefile from [c24013b9d0] to [f6e6a1d934].
︙ | ︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | SRCS = OFArrayTests.m \ OFCharacterSetTests.m \ OFColorTests.m \ OFConcreteArrayTests.m \ OFConcreteMutableArrayTests.m \ OFCryptographicHashTests.m \ OFDateTests.m \ OFIRITests.m \ OFInvocationTests.m \ OFJSONTests.m \ OFMatrix4x4Tests.m \ OFMethodSignatureTests.m \ OFMutableArrayTests.m \ OFNumberTests.m \ | > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | SRCS = OFArrayTests.m \ OFCharacterSetTests.m \ OFColorTests.m \ OFConcreteArrayTests.m \ OFConcreteMutableArrayTests.m \ OFCryptographicHashTests.m \ OFDateTests.m \ OFHMACTests.m \ OFIRITests.m \ OFInvocationTests.m \ OFJSONTests.m \ OFMatrix4x4Tests.m \ OFMethodSignatureTests.m \ OFMutableArrayTests.m \ OFNumberTests.m \ |
︙ | ︙ |
Modified new_tests/OFCryptographicHashTests.m from [960d980959] to [9a95ece37d].
︙ | ︙ | |||
18 19 20 21 22 23 24 | #include <string.h> #import "ObjFW.h" #import "ObjFWTest.h" @interface OFCryptographicHashTests: OTTestCase { | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include <string.h> #import "ObjFW.h" #import "ObjFWTest.h" @interface OFCryptographicHashTests: OTTestCase { OFStream *_stream; } @end const unsigned char testFileMD5[16] = "\x00\x8B\x9D\x1B\x58\xDF\xF8\xFE\xEE\xF3\xAE\x8D\xBB\x68\x2D\x38"; const unsigned char testFileRIPEMD160[20] = "\x46\x02\x97\xF5\x85\xDF\xB9\x21\x00\xC8\xF9\x87\xC6\xEC\x84\x0D" |
︙ | ︙ | |||
54 55 56 57 58 59 60 | - (void)setUp { OFIRI *IRI; [super setUp]; IRI = [OFIRI IRIWithString: @"embedded:testfile.bin"]; | | | > > | | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | - (void)setUp { OFIRI *IRI; [super setUp]; IRI = [OFIRI IRIWithString: @"embedded:testfile.bin"]; _stream = [[OFIRIHandler openItemAtIRI: IRI mode: @"r"] retain]; } - (void)tearDown { [_stream close]; [super tearDown]; } - (void)dealloc { [_stream release]; [super dealloc]; } - (void)testHash: (Class)hashClass expectedDigest: (const unsigned char *)expectedDigest { id <OFCryptographicHash> hash = [hashClass hashWithAllowsSwappableMemory: true]; id <OFCryptographicHash> copy; OTAssertNotNil(hash); while (!_stream.atEndOfStream) { char buffer[64]; size_t length = [_stream readIntoBuffer: buffer length: 64]; [hash updateWithBuffer: buffer length: length]; } copy = [[hash copy] autorelease]; [hash calculate]; [copy calculate]; |
︙ | ︙ |
Renamed and modified tests/OFHMACTests.m [b03d7ee96c] to new_tests/OFHMACTests.m [726dca6e51].
︙ | ︙ | |||
13 14 15 16 17 18 19 | * file. */ #include "config.h" #include <string.h> | | > > > > > > | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | * file. */ #include "config.h" #include <string.h> #import "ObjFW.h" #import "ObjFWTest.h" @interface OFHMACTests: OTTestCase { OFStream *_stream; } @end static const uint8_t key[] = "yM9h8K6IWnJRvxC/0F8XRWG7RnACDBz8wqK2tbXrYVLoKC3vPLeJikyJSM47tVHc" "DlXHww9zULAC2sJUlm2Kg1z4oz2aXY3Y1PQSB4VkC/m0DQ7hCI6cAg4TWnKdzWTy" "cvYGX+Y6HWeDY79/PGSd8fNItme6I8w4HDBqU7BP2sum3jbePJqoiSnhcyJZQTeZ" "jw0ZXoyrfHgOYD2M+NsTDaGpLblFtQ7n5CczjKtafG40PkEwx1dcrd46U9i3GyTK"; static const size_t keyLength = sizeof(key); static const uint8_t MD5Digest[] = |
︙ | ︙ | |||
43 44 45 46 47 48 49 | "\x14\x52\x33\x4B\x9C\x5F\xD8\x07\x4E\x98\xAE\x97\x46\x29\x24\xB4"; static const uint8_t SHA512Digest[] = "\xF5\x8C\x3F\x9C\xA2\x2F\x0A\xF3\x26\xD8\xC0\x7E\x20\x63\x88\x61" "\xC9\xE1\x1F\xD7\xC7\xE5\x59\x33\xD5\x2F\xAF\x56\x1C\x94\xC8\xA4" "\x61\xB3\xF9\x1A\xE3\x09\x43\xA6\x5B\x85\xB1\x50\x5B\xCB\x1A\x2E" "\xB7\xE8\x87\xC1\x73\x19\x63\xF6\xA2\x91\x8D\x7E\x2E\xCC\xEC\x99"; | | | > | > > | | < < | | < | > > | > > | | > > | < | > | < < | > > | | | | < < > | < < | < < < < < < < < < < | | | > | | | > > | | > > | | > | < < > | > | < < > | < < < | > | | > | | > | | > > | > | | | < > > | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | "\x14\x52\x33\x4B\x9C\x5F\xD8\x07\x4E\x98\xAE\x97\x46\x29\x24\xB4"; static const uint8_t SHA512Digest[] = "\xF5\x8C\x3F\x9C\xA2\x2F\x0A\xF3\x26\xD8\xC0\x7E\x20\x63\x88\x61" "\xC9\xE1\x1F\xD7\xC7\xE5\x59\x33\xD5\x2F\xAF\x56\x1C\x94\xC8\xA4" "\x61\xB3\xF9\x1A\xE3\x09\x43\xA6\x5B\x85\xB1\x50\x5B\xCB\x1A\x2E" "\xB7\xE8\x87\xC1\x73\x19\x63\xF6\xA2\x91\x8D\x7E\x2E\xCC\xEC\x99"; @implementation OFHMACTests - (void)setUp { OFIRI *IRI; [super setUp]; IRI = [OFIRI IRIWithString: @"embedded:testfile.bin"]; _stream = [[OFIRIHandler openItemAtIRI: IRI mode: @"r"] retain]; } - (void)tearDown { [_stream close]; [super tearDown]; } - (void)dealloc { [_stream release]; [super dealloc]; } - (void)testWithHashClass: (Class)hashClass expectedDigest: (const unsigned char *)expectedDigest { OFHMAC *HMAC = [OFHMAC HMACWithHashClass: hashClass allowsSwappableMemory: true]; OTAssertNotNil(HMAC); OTAssertThrowsSpecific([HMAC updateWithBuffer: "" length: 0], OFInvalidArgumentException); [HMAC setKey: key length: keyLength]; while (!_stream.atEndOfStream) { char buffer[64]; size_t length = [_stream readIntoBuffer: buffer length: 64]; [HMAC updateWithBuffer: buffer length: length]; } [HMAC calculate]; OTAssertEqual(memcmp(HMAC.digest, expectedDigest, HMAC.digestSize), 0); } - (void)testHMACWithMD5 { [self testWithHashClass: [OFMD5Hash class] expectedDigest: MD5Digest]; } - (void)testHMACWithRIPEMD160 { [self testWithHashClass: [OFRIPEMD160Hash class] expectedDigest: RIPEMD160Digest]; } - (void)testHMACWithSHA1 { [self testWithHashClass: [OFSHA1Hash class] expectedDigest: SHA1Digest]; } - (void)testHMACWithSHA256 { [self testWithHashClass: [OFSHA256Hash class] expectedDigest: SHA256Digest]; } - (void)testHMACWithSHA384 { [self testWithHashClass: [OFSHA384Hash class] expectedDigest: SHA384Digest]; } - (void)testHMACWithSHA512 { [self testWithHashClass: [OFSHA512Hash class] expectedDigest: SHA512Digest]; } @end |
Modified tests/Makefile from [1d6befcb93] to [7ea80715b4].
1 2 3 4 5 6 7 8 9 10 11 | include ../extra.mk SUBDIRS = ${OBJC_SYNC} \ terminal CLEAN = EBOOT.PBP \ boot.dol \ ${PROG_NOINST}.arm9 \ ${PROG_NOINST}.nds \ ${PROG_NOINST}.nro \ ${PROG_NOINST}.rpx \ | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | include ../extra.mk SUBDIRS = ${OBJC_SYNC} \ terminal CLEAN = EBOOT.PBP \ boot.dol \ ${PROG_NOINST}.arm9 \ ${PROG_NOINST}.nds \ ${PROG_NOINST}.nro \ ${PROG_NOINST}.rpx \ testfile_ini.m DISTCLEAN = Info.plist PROG_NOINST = tests${PROG_SUFFIX} STATIC_LIB_NOINST = ${TESTS_STATIC_LIB} SRCS = ForwardingTests.m \ ${OF_BLOCK_TESTS_M} \ OFDataTests.m \ OFDictionaryTests.m \ OFINIFileTests.m \ OFListTests.m \ OFLocaleTests.m \ OFMemoryStreamTests.m \ OFNotificationCenterTests.m \ OFObjectTests.m \ OFSetTests.m \ |
︙ | ︙ | |||
37 38 39 40 41 42 43 | RuntimeTests.m \ ${RUNTIME_ARC_TESTS_M} \ TestsAppDelegate.m \ ${USE_SRCS_FILES} \ ${USE_SRCS_SOCKETS} \ ${USE_SRCS_THREADS} \ ${USE_SRCS_WINDOWS} \ | < | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | RuntimeTests.m \ ${RUNTIME_ARC_TESTS_M} \ TestsAppDelegate.m \ ${USE_SRCS_FILES} \ ${USE_SRCS_SOCKETS} \ ${USE_SRCS_THREADS} \ ${USE_SRCS_WINDOWS} \ testfile_ini.m SRCS_SOCKETS = OFDNSResolverTests.m \ ${OF_HTTP_CLIENT_TESTS_M} \ OFHTTPCookieTests.m \ OFHTTPCookieManagerTests.m \ OFKernelEventObserverTests.m \ OFTCPSocketTests.m \ |
︙ | ︙ | |||
63 64 65 66 67 68 69 | SRCS_WINDOWS = OFWindowsRegistryKeyTests.m IOS_USER ?= mobile IOS_TMP ?= /tmp/objfw-test include ../buildsys.mk | < < | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | SRCS_WINDOWS = OFWindowsRegistryKeyTests.m IOS_USER ?= mobile IOS_TMP ?= /tmp/objfw-test include ../buildsys.mk testfile_ini.m: testfile.ini ${SHELL} ../utils/objfw-embed testfile.ini testfile.ini $@ .PHONY: run run-on-ios run-on-android run: rm -f libobjfw.so.${OBJFW_LIB_MAJOR} rm -f libobjfw.so.${OBJFW_LIB_MAJOR_MINOR} |
︙ | ︙ |
Modified tests/TestsAppDelegate.h from [ed4410669a] to [5430f4b6a3].
︙ | ︙ | |||
99 100 101 102 103 104 105 | - (void)INIFileTests; @end @interface TestsAppDelegate (OFIPXSocketTests) - (void)IPXSocketTests; @end | < < < < | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | - (void)INIFileTests; @end @interface TestsAppDelegate (OFIPXSocketTests) - (void)IPXSocketTests; @end @interface TestsAppDelegate (OFKernelEventObserverTests) - (void)kernelEventObserverTests; @end @interface TestsAppDelegate (OFListTests) - (void)listTests; @end |
︙ | ︙ |
Modified tests/TestsAppDelegate.m from [3c96b957f7] to [f2f9977222].
︙ | ︙ | |||
384 385 386 387 388 389 390 | [self dictionaryTests]; [self listTests]; [self setTests]; [self valueTests]; [self streamTests]; [self memoryStreamTests]; [self notificationCenterTests]; | < | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | [self dictionaryTests]; [self listTests]; [self setTests]; [self valueTests]; [self streamTests]; [self memoryStreamTests]; [self notificationCenterTests]; #ifdef HAVE_CODEPAGE_437 [self INIFileTests]; #endif #ifdef OF_HAVE_SOCKETS [self TCPSocketTests]; [self UDPSocketTests]; # ifdef OF_HAVE_UNIX_SOCKETS |
︙ | ︙ |
Deleted tests/testfile.bin version [ac78121630].
cannot compute difference between binary files