Overview
Comment: | Migrate OFSystemInfoTests to ObjFWTest |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | objfwtest |
Files: | files | file ages | folders |
SHA3-256: |
6ae7f7cdbfed79ede3cdc7a64e8ce059 |
User & Date: | js on 2024-02-12 22:35:47 |
Other Links: | branch diff | manifest | tags |
Context
2024-02-12
| ||
22:49 | Migrate OFDNSResolverTests to ObjFWTest check-in: 53a95fade7 user: js tags: objfwtest | |
22:35 | Migrate OFSystemInfoTests to ObjFWTest check-in: 6ae7f7cdbf user: js tags: objfwtest | |
21:31 | Migrate OFSetTests to ObjFWTest check-in: a7780ddefc user: js tags: objfwtest | |
Changes
Modified new_tests/Makefile from [69dc6a030f] to [f5774930f1].
︙ | ︙ | |||
31 32 33 34 35 36 37 38 39 40 41 42 43 44 | OFMutableArrayTests.m \ OFMutableSetTests.m \ OFNumberTests.m \ OFPBKDF2Tests.m \ OFPropertyListTests.m \ OFScryptTests.m \ OFSetTests.m \ ${USE_SRCS_PLUGINS} \ ${USE_SRCS_SOCKETS} \ ${USE_SRCS_SUBPROCESSES} \ ${USE_SRCS_THREADS} \ testfile_bin.m \ testfile_ini.m SRCS_PLUGINS = OFPluginTests.m | > | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | OFMutableArrayTests.m \ OFMutableSetTests.m \ OFNumberTests.m \ OFPBKDF2Tests.m \ OFPropertyListTests.m \ OFScryptTests.m \ OFSetTests.m \ OFSystemInfoTests.m \ ${USE_SRCS_PLUGINS} \ ${USE_SRCS_SOCKETS} \ ${USE_SRCS_SUBPROCESSES} \ ${USE_SRCS_THREADS} \ testfile_bin.m \ testfile_ini.m SRCS_PLUGINS = OFPluginTests.m |
︙ | ︙ |
Modified new_tests/OFConcreteMutableSetTests.m from [e9e9d6bd08] to [b0e6f39f4d].
︙ | ︙ | |||
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | OTAssertThrowsSpecific([enumerator nextObject], OFEnumerationMutationException); } - (void)testDetectMutationDuringFastEnumeration { bool detected = false; @try { for (OFString *object in _mutableSet) [_mutableSet removeObject: object]; } @catch (OFEnumerationMutationException *e) { detected = true; } OTAssertTrue(detected); } #ifdef OF_HAVE_BLOCKS - (void)testDetectMutationDuringEnumerateObjectsUsingBlock { OTAssertThrowsSpecific( | > > | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | OTAssertThrowsSpecific([enumerator nextObject], OFEnumerationMutationException); } - (void)testDetectMutationDuringFastEnumeration { bool detected = false; @try { for (OFString *object in _mutableSet) [_mutableSet removeObject: object]; } @catch (OFEnumerationMutationException *e) { detected = true; } OTAssertTrue(detected); } #ifdef OF_HAVE_BLOCKS - (void)testDetectMutationDuringEnumerateObjectsUsingBlock { OTAssertThrowsSpecific( |
︙ | ︙ |
Renamed and modified tests/OFSystemInfoTests.m [f3db5fbea9] to new_tests/OFSystemInfoTests.m [89e82ce05a].
︙ | ︙ | |||
11 12 13 14 15 16 17 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" | | > > > > | | | < | > | > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < | < < | | < < | < < | < < | < < | < < > < | | | | | < | | | | | < | | < | < < < < < < < < < < < < < < < < < < < < < < | | | > | | | > > > > | > > > | | | > | | | | | > | | | | | | | | | | < < | < | < < | < | < < | < | < < | < | < < | | < < | | < < | | | | > > > > > | | | > | | > | | > | | > | | > | > | | > > | < > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 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 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "ObjFW.h" #import "ObjFWTest.h" @interface OFSystemInfoTests: OTTestCase @end #ifdef OF_HAVE_SOCKETS static void appendAddresses(OFMutableString *string, OFData *addresses, bool *firstAddress) { size_t count = addresses.count; for (size_t i = 0; i < count; i++) { const OFSocketAddress *address = [addresses itemAtIndex: i]; if (!*firstAddress) [string appendString: @", "]; *firstAddress = false; [string appendString: OFSocketAddressString(address)]; } } #endif @implementation OFSystemInfoTests + (OFArray OF_GENERIC(OFPair OF_GENERIC(OFString *, id) *) *)summary { OFMutableArray *summary = [OFMutableArray array]; #ifdef OF_HAVE_SOCKETS OFDictionary *networkInterfaces; OFMutableString *networkInterfacesString; bool firstInterface = true; #endif #define ADD(name, value) \ [summary addObject: [OFPair pairWithFirstObject: name \ secondObject: value]]; #define ADD_UINT(name, value) \ ADD(name, [OFNumber numberWithUnsignedInt: value]); #define ADD_ULONGLONG(name, value) \ ADD(name, [OFNumber numberWithUnsignedLongLong: value]); #define ADD_BOOL(name, value) \ ADD(name, [OFNumber numberWithBool: value]); ADD(@"ObjFW version", [OFSystemInfo ObjFWVersion]) ADD_UINT(@"ObjFW version major", [OFSystemInfo ObjFWVersionMajor]) ADD_UINT(@"ObjFW version minor", [OFSystemInfo ObjFWVersionMinor]) ADD(@"Operating system name", [OFSystemInfo operatingSystemName]); ADD(@"Operating system version", [OFSystemInfo operatingSystemVersion]); ADD_ULONGLONG(@"Page size", [OFSystemInfo pageSize]); ADD_ULONGLONG(@"Number of CPUs", [OFSystemInfo numberOfCPUs]); ADD(@"User config IRI", [OFSystemInfo userConfigIRI].string); ADD(@"User data IRI", [OFSystemInfo userDataIRI].string); ADD(@"Temporary directory IRI", [OFSystemInfo temporaryDirectoryIRI].string); ADD(@"CPU vendor", [OFSystemInfo CPUVendor]); ADD(@"CPU model", [OFSystemInfo CPUModel]); #if defined(OF_AMD64) || defined(OF_X86) ADD_BOOL(@"Supports MMX", [OFSystemInfo supportsMMX]); ADD_BOOL(@"Supports 3DNow!", [OFSystemInfo supports3DNow]); ADD_BOOL(@"Supports enhanced 3DNow!", [OFSystemInfo supportsEnhanced3DNow]); ADD_BOOL(@"Supports SSE", [OFSystemInfo supportsSSE]); ADD_BOOL(@"Supports SSE2", [OFSystemInfo supportsSSE2]); ADD_BOOL(@"Supports SSE3", [OFSystemInfo supportsSSE3]); ADD_BOOL(@"Supports SSSE3", [OFSystemInfo supportsSSSE3]); ADD_BOOL(@"Supports SSE4.1", [OFSystemInfo supportsSSE41]); ADD_BOOL(@"Supports SSE4.2", [OFSystemInfo supportsSSE42]); ADD_BOOL(@"Supports AVX", [OFSystemInfo supportsAVX]); ADD_BOOL(@"Supports AVX2", [OFSystemInfo supportsAVX2]); ADD_BOOL(@"Supports AES-NI", [OFSystemInfo supportsAESNI]); ADD_BOOL(@"Supports SHA extensions", [OFSystemInfo supportsSHAExtensions]); ADD_BOOL(@"Supports fused multiply-add", [OFSystemInfo supportsFusedMultiplyAdd]); ADD_BOOL(@"Supports F16C", [OFSystemInfo supportsF16C]); ADD_BOOL(@"Supports AVX-512 Foundation", [OFSystemInfo supportsAVX512Foundation]); ADD_BOOL(@"Supports AVX-512 Conflict Detection Instructions", [OFSystemInfo supportsAVX512ConflictDetectionInstructions]); ADD_BOOL(@"Supports AVX-512 Exponential and Reciprocal Instructions", [OFSystemInfo supportsAVX512ExponentialAndReciprocalInstructions]); ADD_BOOL(@"Supports AVX-512 Prefetch Instructions", [OFSystemInfo supportsAVX512PrefetchInstructions]); ADD_BOOL(@"Supports AVX-512 Vector Length Extensions", [OFSystemInfo supportsAVX512VectorLengthExtensions]); ADD_BOOL(@"Supports AVX-512 Doubleword and Quadword Instructions", [OFSystemInfo supportsAVX512DoublewordAndQuadwordInstructions]); ADD_BOOL(@"Supports AVX-512 Byte and Word Instructions", [OFSystemInfo supportsAVX512ByteAndWordInstructions]); ADD_BOOL(@"Supports AVX-512 Integer Fused Multiply Add", [OFSystemInfo supportsAVX512IntegerFusedMultiplyAdd]); ADD_BOOL(@"Supports AVX-512 Vector Byte Manipulation Instructions", [OFSystemInfo supportsAVX512VectorByteManipulationInstructions]); ADD_BOOL(@"Supports AVX-512 Vector Population Count Instruction", [OFSystemInfo supportsAVX512VectorPopulationCountInstruction]); ADD_BOOL(@"Supports AVX-512 Vector Neutral Network Instructions", [OFSystemInfo supportsAVX512VectorNeuralNetworkInstructions]); ADD_BOOL(@"Supports AVX-512 Vector Byte Manipulation Instructions 2", [OFSystemInfo supportsAVX512VectorByteManipulationInstructions2]); ADD_BOOL(@"Supports AVX-512 Bit Algorithms", [OFSystemInfo supportsAVX512BitAlgorithms]); ADD_BOOL(@"Supports AVX-512 Float16 Instructions", [OFSystemInfo supportsAVX512Float16Instructions]); ADD_BOOL(@"Supports AVX-512 BFloat16 Instructions", [OFSystemInfo supportsAVX512BFloat16Instructions]); #endif #ifdef OF_POWERPC ADD_BOOL(@"[OFSystemInfo] Supports AltiVec", [OFSystemInfo supportsAltiVec]); #endif #undef ADD #undef ADD_UINT #undef ADD_ULONGLONG #undef ADD_BOOL #ifdef OF_HAVE_SOCKETS networkInterfaces = [OFSystemInfo networkInterfaces]; networkInterfacesString = [OFMutableString string]; for (OFString *name in networkInterfaces) { bool firstAddress = true; OFNetworkInterface interface; OFData *hardwareAddress; if (!firstInterface) [networkInterfacesString appendString: @"; "]; firstInterface = false; [networkInterfacesString appendFormat: @"%@(", name]; interface = [networkInterfaces objectForKey: name]; appendAddresses(networkInterfacesString, [interface objectForKey: OFNetworkInterfaceIPv4Addresses], &firstAddress); # ifdef OF_HAVE_IPV6 appendAddresses(networkInterfacesString, [interface objectForKey: OFNetworkInterfaceIPv6Addresses], &firstAddress); # endif # ifdef OF_HAVE_IPX appendAddresses(networkInterfacesString, [interface objectForKey: OFNetworkInterfaceIPXAddresses], &firstAddress); # endif # ifdef OF_HAVE_APPLETALK appendAddresses(networkInterfacesString, [interface objectForKey: OFNetworkInterfaceAppleTalkAddresses], &firstAddress); # endif hardwareAddress = [interface objectForKey: OFNetworkInterfaceHardwareAddress]; if (hardwareAddress != nil) { const unsigned char *bytes = hardwareAddress.items; size_t length = hardwareAddress.count; if (!firstAddress) [networkInterfacesString appendString: @", "]; for (size_t i = 0; i < length; i++) { if (i > 0) [networkInterfacesString appendString: @":"]; [networkInterfacesString appendFormat: @"%02X", bytes[i]]; } } [networkInterfacesString appendString: @")"]; } [summary addObject: [OFPair pairWithFirstObject: @"Network interfaces" secondObject: networkInterfacesString]]; #endif return summary; } @end |
Deleted src/test/OTAppDelegate.h version [64bf862003].
|
| < < < < < < < < < < < < < < < < < < < < < < < |
Modified src/test/OTAppDelegate.m from [c000033e03] to [6f0346b1a1].
︙ | ︙ | |||
11 12 13 14 15 16 17 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" | | | | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFApplication.h" #import "OFColor.h" #import "OFDictionary.h" #import "OFMethodSignature.h" #import "OFSet.h" #import "OFStdIOStream.h" #import "OFValue.h" #import "OTTestCase.h" #import "OTAssertionFailedException.h" @interface OTAppDelegate: OFObject <OFApplicationDelegate> @end OF_APPLICATION_DELEGATE(OTAppDelegate) static bool isSubclassOfClass(Class class, Class superclass) { for (Class iter = class; iter != Nil; iter = class_getSuperclass(iter)) |
︙ | ︙ | |||
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | [OFStdOut reset]; } - (void)applicationDidFinishLaunching: (OFNotification *)notification { OFSet OF_GENERIC(Class) *testClasses = [self testClasses]; size_t numSucceeded = 0, numFailed = 0; [OFStdOut writeFormat: @"Running %zu test case(s)\n", testClasses.count]; for (Class class in testClasses) { [OFStdOut setForegroundColor: [OFColor teal]]; [OFStdOut writeFormat: @"Running ", class]; [OFStdOut setForegroundColor: [OFColor aqua]]; [OFStdOut writeFormat: @"%@\n", class]; [OFStdOut reset]; for (OFValue *test in [self testsInClass: class]) { | > > > | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | [OFStdOut reset]; } - (void)applicationDidFinishLaunching: (OFNotification *)notification { OFSet OF_GENERIC(Class) *testClasses = [self testClasses]; size_t numSucceeded = 0, numFailed = 0; OFMutableDictionary *summaries = [OFMutableDictionary dictionary]; [OFStdOut writeFormat: @"Running %zu test case(s)\n", testClasses.count]; for (Class class in testClasses) { OFArray *summary; [OFStdOut setForegroundColor: [OFColor teal]]; [OFStdOut writeFormat: @"Running ", class]; [OFStdOut setForegroundColor: [OFColor aqua]]; [OFStdOut writeFormat: @"%@\n", class]; [OFStdOut reset]; for (OFValue *test in [self testsInClass: class]) { |
︙ | ︙ | |||
229 230 231 232 233 234 235 236 237 238 239 240 241 242 | description: nil]; numSucceeded++; } else numFailed++; objc_autoreleasePoolPop(pool); } } [OFStdOut setForegroundColor: [OFColor fuchsia]]; [OFStdOut writeFormat: @"%zu", numSucceeded]; [OFStdOut setForegroundColor: [OFColor purple]]; [OFStdOut writeString: @" test(s) succeeded, "]; [OFStdOut setForegroundColor: [OFColor fuchsia]]; | > > > > > > > > > > > > > > > > > > > > | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | description: nil]; numSucceeded++; } else numFailed++; objc_autoreleasePoolPop(pool); } summary = [class summary]; if (summary != nil) [summaries setObject: summary forKey: class]; } for (Class class in summaries) { OFArray *summary = [summaries objectForKey: class]; [OFStdOut setForegroundColor: [OFColor teal]]; [OFStdOut writeString: @"Summary for "]; [OFStdOut setForegroundColor: [OFColor aqua]]; [OFStdOut writeFormat: @"%@\n", class]; for (OFPair *line in summary) { [OFStdOut setForegroundColor: [OFColor navy]]; [OFStdOut writeFormat: @"%@: ", line.firstObject]; [OFStdOut setForegroundColor: [OFColor blue]]; [OFStdOut writeFormat: @"%@\n", line.secondObject]; } } [OFStdOut setForegroundColor: [OFColor fuchsia]]; [OFStdOut writeFormat: @"%zu", numSucceeded]; [OFStdOut setForegroundColor: [OFColor purple]]; [OFStdOut writeString: @" test(s) succeeded, "]; [OFStdOut setForegroundColor: [OFColor fuchsia]]; |
︙ | ︙ |
Modified src/test/OTTestCase.h from [2add704de5] to [a61157e757].
︙ | ︙ | |||
10 11 12 13 14 15 16 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #ifdef OBJFWTEST_LOCAL_INCLUDES | | | > > > > > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #ifdef OBJFWTEST_LOCAL_INCLUDES # import "ObjFW.h" #else # import <ObjFW/ObjFW.h> #endif OF_ASSUME_NONNULL_BEGIN @interface OTTestCase: OFObject #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, readonly, nullable, nonatomic) OFArray OF_GENERIC(OFPair OF_GENERIC(OFString *, id) *) *summary; #endif + (nullable OFArray OF_GENERIC(OFPair OF_GENERIC(OFString *, id) *) *)summary; - (void)setUp; - (void)tearDown; @end OF_ASSUME_NONNULL_END |
Modified src/test/OTTestCase.m from [3c3d45f200] to [fdb0a500c1].
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | */ #include "config.h" #import "OTTestCase.h" @implementation OTTestCase: OFObject - (void)setUp { } - (void)tearDown { } | > > > > > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | */ #include "config.h" #import "OTTestCase.h" @implementation OTTestCase: OFObject + (OFArray OF_GENERIC(OFPair OF_GENERIC(OFString *, id) *) *)summary { return nil; } - (void)setUp { } - (void)tearDown { } |
︙ | ︙ |
Modified tests/Makefile from [c7cd8bdf37] to [42d6b45d97].
︙ | ︙ | |||
20 21 22 23 24 25 26 | OFListTests.m \ OFLocaleTests.m \ OFMemoryStreamTests.m \ OFNotificationCenterTests.m \ OFObjectTests.m \ OFStreamTests.m \ OFStringTests.m \ | < | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | OFListTests.m \ OFLocaleTests.m \ OFMemoryStreamTests.m \ OFNotificationCenterTests.m \ OFObjectTests.m \ OFStreamTests.m \ OFStringTests.m \ OFValueTests.m \ OFXMLElementBuilderTests.m \ OFXMLNodeTests.m \ OFXMLParserTests.m \ RuntimeTests.m \ ${RUNTIME_ARC_TESTS_M} \ TestsAppDelegate.m \ |
︙ | ︙ |
Modified tests/TestsAppDelegate.h from [4518a58e6b] to [91bf45835f].
︙ | ︙ | |||
135 136 137 138 139 140 141 | - (void)SPXSocketTests; @end @interface TestsAppDelegate (OFSPXStreamSocketTests) - (void)SPXStreamSocketTests; @end | < < < < | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | - (void)SPXSocketTests; @end @interface TestsAppDelegate (OFSPXStreamSocketTests) - (void)SPXStreamSocketTests; @end @interface TestsAppDelegate (OFStreamTests) - (void)streamTests; @end @interface TestsAppDelegate (OFStringTests) - (void)stringTests; @end |
︙ | ︙ |
Modified tests/TestsAppDelegate.m from [b4049e205f] to [db4c4e8f5b].
︙ | ︙ | |||
418 419 420 421 422 423 424 | #ifdef OF_WINDOWS [self windowsRegistryKeyTests]; #endif #ifdef OF_HAVE_SOCKETS [self DNSResolverTests]; #endif | < | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | #ifdef OF_WINDOWS [self windowsRegistryKeyTests]; #endif #ifdef OF_HAVE_SOCKETS [self DNSResolverTests]; #endif [self localeTests]; [OFStdOut reset]; #if defined(OF_IOS) [OFStdOut writeFormat: @"%d tests failed!", _fails]; [OFApplication terminateWithStatus: _fails]; |
︙ | ︙ |