Overview
Comment: | tests: Use new terminal control methods |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
cdaa971823221fc71dbcdc15c1e7b382 |
User & Date: | js on 2020-05-22 00:16:56 |
Other Links: | manifest | tags |
Context
2020-05-22
| ||
02:28 | OFCharacterSet: Better singleton initialization check-in: ca8c67fb83 user: js tags: trunk | |
00:16 | tests: Use new terminal control methods check-in: cdaa971823 user: js tags: trunk | |
2020-05-21
| ||
23:18 | OFStdIOStream: Add more terminal control methods check-in: 36960e428a user: js tags: trunk | |
Changes
Modified tests/OFDNSResolverTests.m from [d86ca4b2a2] to [8f7194537b].
︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | @implementation TestsAppDelegate (OFDNSResolverTests) - (void)DNSResolverTests { void *pool = objc_autoreleasePoolPush(); OFDNSResolver *resolver = [OFDNSResolver resolver]; OFMutableString *staticHosts = [OFMutableString string]; for (OFString *host in resolver.staticHosts) { OFString *IPs; if (staticHosts.length > 0) [staticHosts appendString: @"; "]; IPs = [[resolver.staticHosts objectForKey: host] componentsJoinedByString: @", "]; [staticHosts appendFormat: @"%@=(%@)", host, IPs]; } | > > > | | | > | | | > | > | > | | > | > | | | 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 | @implementation TestsAppDelegate (OFDNSResolverTests) - (void)DNSResolverTests { void *pool = objc_autoreleasePoolPush(); OFDNSResolver *resolver = [OFDNSResolver resolver]; OFMutableString *staticHosts = [OFMutableString string]; of_stdout.foregroundColor = [OFColor lime]; for (OFString *host in resolver.staticHosts) { OFString *IPs; if (staticHosts.length > 0) [staticHosts appendString: @"; "]; IPs = [[resolver.staticHosts objectForKey: host] componentsJoinedByString: @", "]; [staticHosts appendFormat: @"%@=(%@)", host, IPs]; } [of_stdout writeFormat: @"[OFDNSResolver] Static hosts: %@\n", staticHosts]; [of_stdout writeFormat: @"[OFDNSResolver] Name servers: %@\n", [resolver.nameServers componentsJoinedByString: @", "]]; [of_stdout writeFormat: @"[OFDNSResolver] Local domain: %@\n", resolver.localDomain]; [of_stdout writeFormat: @"[OFDNSResolver] Search domains: %@\n", [resolver.searchDomains componentsJoinedByString: @", "]]; [of_stdout writeFormat: @"[OFDNSResolver] Timeout: %lf\n", resolver.timeout]; [of_stdout writeFormat: @"[OFDNSResolver] Max attempts: %u\n", resolver.maxAttempts]; [of_stdout writeFormat: @"[OFDNSResolver] Min number of dots in absolute name: %u\n", resolver.minNumberOfDotsInAbsoluteName]; [of_stdout writeFormat: @"[OFDNSResolver] Uses TCP: %u\n", module, resolver.usesTCP]; [of_stdout writeFormat: @"[OFDNSResolver] Config reload interval: %lf\n", resolver.configReloadInterval]; objc_autoreleasePoolPop(pool); } @end |
Modified tests/OFIPXSocketTests.m from [bb7c59cc8b] to [7578ebb381].
︙ | ︙ | |||
36 37 38 39 40 41 42 | @try { TEST(@"-[bindToPort:packetType:]", R(address1 = [sock bindToPort: 0 packetType: 0])) } @catch (OFBindFailedException *e) { switch (e.errNo) { case EAFNOSUPPORT: | > | | | < > | | | < < | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | @try { TEST(@"-[bindToPort:packetType:]", R(address1 = [sock bindToPort: 0 packetType: 0])) } @catch (OFBindFailedException *e) { switch (e.errNo) { case EAFNOSUPPORT: of_stdout.foregroundColor = [OFColor lime]; [of_stdout writeLine: @"[OFIPXSocket] -[bindToPort:packetType:]: " @"IPX unsupported, skipping tests"]; break; case EADDRNOTAVAIL: of_stdout.foregroundColor = [OFColor lime]; [of_stdout writeLine: @"[OFIPXSocket] -[bindToPort:packetType:]: " @"IPX not configured, skipping tests"]; break; default: @throw e; } objc_autoreleasePoolPop(pool); return; |
︙ | ︙ |
Modified tests/OFLocaleTests.m from [bc413d1703] to [bba7d2e3cd].
︙ | ︙ | |||
15 16 17 18 19 20 21 | * file. */ #include "config.h" #import "TestsAppDelegate.h" | < < > > > | > | | | > | | 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 | * file. */ #include "config.h" #import "TestsAppDelegate.h" @implementation TestsAppDelegate (OFLocaleTests) - (void)localeTests { void *pool = objc_autoreleasePoolPush(); of_stdout.foregroundColor = [OFColor lime]; [of_stdout writeFormat: @"[OFLocale]: Language: %@\n", [OFLocale language]]; [of_stdout writeFormat: @"[OFLocale]: Territory: %@\n", [OFLocale territory]]; [of_stdout writeFormat: @"[OFLocale]: Encoding: %@\n", of_string_name_of_encoding([OFLocale encoding])]; [of_stdout writeFormat: @"[OFLocale]: Decimal point: %@\n", [OFLocale decimalPoint]]; objc_autoreleasePoolPop(pool); } @end |
Modified tests/OFSCTPSocketTests.m from [769c4509cc] to [42f1cba28c].
︙ | ︙ | |||
38 39 40 41 42 43 44 | @try { TEST(@"-[bindToHost:port:]", (port = [server bindToHost: @"127.0.0.1" port: 0])) } @catch (OFBindFailedException *e) { switch (e.errNo) { case EPROTONOSUPPORT: | > | | | < | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | @try { TEST(@"-[bindToHost:port:]", (port = [server bindToHost: @"127.0.0.1" port: 0])) } @catch (OFBindFailedException *e) { switch (e.errNo) { case EPROTONOSUPPORT: of_stdout.foregroundColor = [OFColor lime]; [of_stdout writeLine: @"[OFSCTPSocket] -[bindToHost:port:]: " @"SCTP unsupported, skipping tests"]; break; default: @throw e; } objc_autoreleasePoolPop(pool); return; |
︙ | ︙ |
Modified tests/OFSPXSocketTests.m from [7d4ded3732] to [6d42db054f].
︙ | ︙ | |||
88 89 90 91 92 93 94 | @try { TEST(@"-[bindToPort:]", R(address1 = [sockServer bindToPort: 0])) } @catch (OFBindFailedException *e) { switch (e.errNo) { case EAFNOSUPPORT: | > > | | < > > | | < > > | | < < | 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 | @try { TEST(@"-[bindToPort:]", R(address1 = [sockServer bindToPort: 0])) } @catch (OFBindFailedException *e) { switch (e.errNo) { case EAFNOSUPPORT: of_stdout.foregroundColor = [OFColor lime]; [of_stdout writeLine: @"[OFSPXSocket] -[bindToPort:]: " @"IPX unsupported, skipping tests"]; break; case ESOCKTNOSUPPORT: of_stdout.foregroundColor = [OFColor lime]; [of_stdout writeLine: @"[OFSPXSocket] -[bindToPort:]: " @"SPX unsupported, skipping tests"]; break; case EADDRNOTAVAIL: of_stdout.foregroundColor = [OFColor lime]; [of_stdout writeLine: @"[OFSPXSocket] -[bindToPort:]: " @"IPX not configured, skipping tests"]; break; default: @throw e; } objc_autoreleasePoolPop(pool); return; |
︙ | ︙ |
Modified tests/OFSPXStreamSocketTests.m from [d6d586374c] to [c4c06acd4d].
︙ | ︙ | |||
88 89 90 91 92 93 94 | @try { TEST(@"-[bindToPort:]", R(address1 = [sockServer bindToPort: 0])) } @catch (OFBindFailedException *e) { switch (e.errNo) { case EAFNOSUPPORT: | | > | | < | > | | < | > | | < < | 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 | @try { TEST(@"-[bindToPort:]", R(address1 = [sockServer bindToPort: 0])) } @catch (OFBindFailedException *e) { switch (e.errNo) { case EAFNOSUPPORT: of_stdout.foregroundColor = [OFColor lime]; [of_stdout writeLine: @"[OFSPXStreamSocket] -[bindToPort:]: " @"IPX unsupported, skipping tests"]; break; case ESOCKTNOSUPPORT: of_stdout.foregroundColor = [OFColor lime]; [of_stdout writeLine: @"[OFSPXStreamSocket] -[bindToPort:]: " @"SPX unsupported, skipping tests"]; break; case EADDRNOTAVAIL: of_stdout.foregroundColor = [OFColor lime]; [of_stdout writeLine: @"[OFSPXStreamSocket] -[bindToPort:]: " @"IPX not configured, skipping tests"]; break; default: @throw e; } objc_autoreleasePoolPop(pool); return; |
︙ | ︙ |
Modified tests/OFSystemInfoTests.m from [fbcca99557] to [fe712afca4].
︙ | ︙ | |||
15 16 17 18 19 20 21 | * file. */ #include "config.h" #import "TestsAppDelegate.h" | < < > > > | > | > | | | | | | | > | | > | > | > | > | > | > | > | > | > | > | > | > | > | > | | | > | | 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 | * file. */ #include "config.h" #import "TestsAppDelegate.h" @implementation TestsAppDelegate (OFSystemInfoTests) - (void)systemInfoTests { void *pool = objc_autoreleasePoolPush(); #ifdef OF_HAVE_FILES OFString *userConfigPath, *userDataPath; #endif of_stdout.foregroundColor = [OFColor lime]; [of_stdout writeFormat: @"[OFSystemInfo] Page size: %zd\n", [OFSystemInfo pageSize]]; [of_stdout writeFormat: @"[OFSystemInfo] Number of CPUs: %zd\n", [OFSystemInfo numberOfCPUs]]; [of_stdout writeFormat: @"[OFSystemInfo] ObjFW version: %@\n", [OFSystemInfo ObjFWVersion]]; [of_stdout writeFormat: @"[OFSystemInfo] ObjFW version major: %u\n", [OFSystemInfo ObjFWVersionMajor]]; [of_stdout writeFormat: @"[OFSystemInfo] ObjFW version minor: %u\n", [OFSystemInfo ObjFWVersionMinor]]; [of_stdout writeFormat: @"[OFSystemInfo] Operating system name: %@\n", [OFSystemInfo operatingSystemName]]; [of_stdout writeFormat: @"[OFSystemInfo] Operating system version: %@\n", [OFSystemInfo operatingSystemVersion]]; #ifdef OF_HAVE_FILES @try { userConfigPath = [OFSystemInfo userConfigPath]; } @catch (OFNotImplementedException *e) { userConfigPath = @"Not implemented"; } [of_stdout writeFormat: @"[OFSystemInfo] User config path: %@\n", userConfigPath]; @try { userDataPath = [OFSystemInfo userDataPath]; } @catch (OFNotImplementedException *e) { userDataPath = @"Not implemented"; } [of_stdout writeFormat: @"[OFSystemInfo] User data path: %@\n", userDataPath]; #endif [of_stdout writeFormat: @"[OFSystemInfo] CPU vendor: %@\n", [OFSystemInfo CPUVendor]]; [of_stdout writeFormat: @"[OFSystemInfo] CPU model: %@\n", [OFSystemInfo CPUModel]]; #if defined(OF_X86_64) || defined(OF_X86) [of_stdout writeFormat: @"[OFSystemInfo] Supports MMX: %d\n", [OFSystemInfo supportsMMX]]; [of_stdout writeFormat: @"[OFSystemInfo] Supports SSE: %d\n", [OFSystemInfo supportsSSE]]; [of_stdout writeFormat: @"[OFSystemInfo] Supports SSE2: %d\n", [OFSystemInfo supportsSSE2]]; [of_stdout writeFormat: @"[OFSystemInfo] Supports SSE3: %d\n", [OFSystemInfo supportsSSE3]]; [of_stdout writeFormat: @"[OFSystemInfo] Supports SSSE3: %d\n", [OFSystemInfo supportsSSSE3]]; [of_stdout writeFormat: @"[OFSystemInfo] Supports SSE4.1: %d\n", [OFSystemInfo supportsSSE41]]; [of_stdout writeFormat: @"[OFSystemInfo] Supports SSE4.2: %d\n", [OFSystemInfo supportsSSE42]]; [of_stdout writeFormat: @"[OFSystemInfo] Supports AVX: %d\n", [OFSystemInfo supportsAVX]]; [of_stdout writeFormat: @"[OFSystemInfo] Supports AVX2: %d\n", [OFSystemInfo supportsAVX2]]; [of_stdout writeFormat: @"[OFSystemInfo] Supports AES-NI: %d\n", [OFSystemInfo supportsAESNI]]; [of_stdout writeFormat: @"[OFSystemInfo] Supports SHA extensions: %d\n", [OFSystemInfo supportsSHAExtensions]]; #endif #ifdef OF_POWERPC [of_stdout writeFormat: @"[OFSystemInfo] Supports AltiVec: %d\n", [OFSystemInfo supportsAltiVec]]; #endif objc_autoreleasePoolPop(pool); } @end |
Modified tests/TestsAppDelegate.h from [9dc2ad757b] to [9cb5b35481].
︙ | ︙ | |||
50 51 52 53 54 55 56 | else { \ [self outputFailure: test \ inModule: module]; \ _fails++; \ } \ } #define R(...) (__VA_ARGS__, 1) | < < < < < < < < < < < < < < < < | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | else { \ [self outputFailure: test \ inModule: module]; \ _fails++; \ } \ } #define R(...) (__VA_ARGS__, 1) @class OFString; @interface TestsAppDelegate: OFObject <OFApplicationDelegate> { int _fails; } - (void)outputTesting: (OFString *)test inModule: (OFString *)module; - (void)outputSuccess: (OFString *)test inModule: (OFString *)module; - (void)outputFailure: (OFString *)test inModule: (OFString *)module; @end |
︙ | ︙ |
Modified tests/TestsAppDelegate.m from [bf81e047c2] to [eb5fcaa32b].
︙ | ︙ | |||
151 152 153 154 155 156 157 | [OFApplication sharedApplication].delegate; OFString *string = [OFString stringWithFormat: @"\nRuntime error: Unhandled exception:\n%@\n", e]; OFString *backtrace = [OFString stringWithFormat: @"\nBacktrace:\n %@\n\n", [[e backtrace] componentsJoinedByString: @"\n "]]; | > | < | | > | | > | | > | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > | < < < | < < | | > | < < | < > > | | < < < > | | > | | > | | > | | > > > > | < | 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 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 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 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | [OFApplication sharedApplication].delegate; OFString *string = [OFString stringWithFormat: @"\nRuntime error: Unhandled exception:\n%@\n", e]; OFString *backtrace = [OFString stringWithFormat: @"\nBacktrace:\n %@\n\n", [[e backtrace] componentsJoinedByString: @"\n "]]; of_stdout.foregroundColor = [OFColor red]; [of_stdout writeString: string]; [of_stdout writeString: backtrace]; # if defined(OF_WII) [of_stdout reset]; [of_stdout writeString: @"Press home button to exit!"]; for (;;) { WPAD_ScanPads(); if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) [OFApplication terminateWithStatus: 1]; VIDEO_WaitVSync(); } # elif defined(OF_PSP) sceKernelSleepThreadCB(); # elif defined(OF_NINTENDO_DS) [of_stdout reset]; [of_stdout writeString: @"Press start button to exit!"]; for (;;) { swiWaitForVBlank(); scanKeys(); if (keysDown() & KEY_START) [OFApplication terminateWithStatus: 1]; } # elif defined(OF_NINTENDO_3DS) [of_stdout reset]; [of_stdout writeString: @"Press start button to exit!"]; for (;;) { hidScanInput(); if (hidKeysDown() & KEY_START) [OFApplication terminateWithStatus: 1]; gspWaitForVBlank(); } # else abort(); # endif } #else return of_application_main(&argc, &argv, [[TestsAppDelegate alloc] init]); #endif } @implementation TestsAppDelegate - (void)outputTesting: (OFString *)test inModule: (OFString *)module { #ifndef STDOUT_SIMPLE of_stdout.foregroundColor = [OFColor yellow]; [of_stdout writeFormat: @"[%@] %@: testing...", module, test]; #else [of_stdout writeFormat: @"[%@] %@: ", module, test]; #endif } - (void)outputSuccess: (OFString *)test inModule: (OFString *)module { #ifndef STDOUT_SIMPLE of_stdout.cursorColumn = 0; of_stdout.foregroundColor = [OFColor lime]; [of_stdout eraseLine]; [of_stdout writeFormat: @"[%@] %@: ok\n", module, test]; #else [of_stdout writeLine: @"ok"]; #endif } - (void)outputFailure: (OFString *)test inModule: (OFString *)module { #ifndef STDOUT_SIMPLE of_stdout.cursorColumn = 0; of_stdout.foregroundColor = [OFColor red]; [of_stdout eraseLine]; [of_stdout writeFormat: @"[%@] %@: failed\n", module, test]; # ifdef OF_WII [of_stdout reset]; [of_stdout writeLine: @"Press A to continue!"]; for (;;) { WPAD_ScanPads(); if (WPAD_ButtonsDown(0) & WPAD_BUTTON_A) return; VIDEO_WaitVSync(); } # endif # ifdef OF_PSP [of_stdout reset]; [of_stdout writeLine: @"Press X to continue!"]; for (;;) { SceCtrlData pad; sceCtrlReadBufferPositive(&pad, 1); if (pad.Buttons & PSP_CTRL_CROSS) { for (;;) { sceCtrlReadBufferPositive(&pad, 1); if (!(pad.Buttons & PSP_CTRL_CROSS)) return; } } } # endif # ifdef OF_NINTENDO_DS [of_stdout reset]; [of_stdout writeString: @"Press A to continue!"]; for (;;) { swiWaitForVBlank(); scanKeys(); if (keysDown() & KEY_A) break; } # endif # ifdef OF_NINTENDO_3DS [of_stdout reset]; [of_stdout writeString: @"Press A to continue!"]; for (;;) { hidScanInput(); if (hidKeysDown() & KEY_A) break; gspWaitForVBlank(); } # endif of_stdout.cursorColumn = 0; [of_stdout reset]; [of_stdout eraseLine]; #else [of_stdout writeLine: @"failed"]; #endif } - (void)applicationDidFinishLaunching { #if defined(OF_IOS) && defined(OF_HAVE_FILES) CFBundleRef mainBundle = CFBundleGetMainBundle(); |
︙ | ︙ | |||
455 456 457 458 459 460 461 462 | #ifdef OF_HAVE_SOCKETS [self DNSResolverTests]; #endif [self systemInfoTests]; [self localeTests]; #if defined(OF_IOS) | > > | < < | | | | < | | | | | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | #ifdef OF_HAVE_SOCKETS [self DNSResolverTests]; #endif [self systemInfoTests]; [self localeTests]; [of_stdout reset]; #if defined(OF_IOS) [of_stdout writeFormat: @"%d tests failed!", _fails]; [OFApplication terminateWithStatus: _fails]; #elif defined(OF_WII) [of_stdout writeString: @"Press home button to exit!"]; for (;;) { WPAD_ScanPads(); if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) [OFApplication terminateWithStatus: _fails]; VIDEO_WaitVSync(); } #elif defined(OF_PSP) [of_stdout writeFormat: @"%d tests failed!", _fails]; sceKernelSleepThreadCB(); #elif defined(OF_NINTENDO_DS) [of_stdout writeString: @"Press start button to exit!"]; for (;;) { swiWaitForVBlank(); scanKeys(); if (keysDown() & KEY_START) [OFApplication terminateWithStatus: _fails]; } #elif defined(OF_NINTENDO_3DS) [of_stdout writeString: @"Press start button to exit!"]; for (;;) { hidScanInput(); if (hidKeysDown() & KEY_START) [OFApplication terminateWithStatus: _fails]; gspWaitForVBlank(); } #else [OFApplication terminateWithStatus: _fails]; #endif } @end |