Differences From Artifact [70ab30c579]:
- File
tests/TestsAppDelegate.m
— part of check-in
[a863ef544f]
at
2021-04-07 21:45:32
on branch trunk
— Remove incomplete SCTP support
It has been moved to the "sctp" branch until it is ready. (user: js, size: 9741) [annotate] [blame] [check-ins using] [more...]
To Artifact [a699240936]:
- File tests/TestsAppDelegate.m — part of check-in [4507e0bee3] at 2021-04-30 21:56:27 on branch asn1 — Merge trunk into branch "asn1" (user: js, size: 9723) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #ifdef OF_NINTENDO_3DS /* Newer versions of libctru started using id as a parameter name. */ # define id id_3ds # include <3ds.h> # undef id #endif #ifdef OF_PSP static int exit_cb(int arg1, int arg2, void *arg) { sceKernelExitGame(); return 0; | > > | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | #ifdef OF_NINTENDO_3DS /* Newer versions of libctru started using id as a parameter name. */ # define id id_3ds # include <3ds.h> # undef id #endif extern unsigned long OFHashSeed; #ifdef OF_PSP static int exit_cb(int arg1, int arg2, void *arg) { sceKernelExitGame(); return 0; |
︙ | ︙ | |||
86 87 88 89 90 91 92 | * Calling objc_exit() via atexit() would result in the runtime being * destructed before for the destructors ran. */ atexit(objc_exit); #endif /* We need deterministic hashes for tests */ | | | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | * Calling objc_exit() via atexit() would result in the runtime being * destructed before for the destructors ran. */ atexit(objc_exit); #endif /* We need deterministic hashes for tests */ OFHashSeed = 0; #ifdef OF_WII GXRModeObj *rmode; void *xfb; VIDEO_Init(); WPAD_Init(); |
︙ | ︙ | |||
135 136 137 138 139 140 141 | consoleInit(GFX_TOP, NULL); #endif #if defined(OF_WII) || defined(OF_PSP) || defined(OF_NINTENDO_DS) || \ defined(OF_NINTENDO_3DS) @try { | | | | | | | | | | | < | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 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 309 310 | consoleInit(GFX_TOP, NULL); #endif #if defined(OF_WII) || defined(OF_PSP) || defined(OF_NINTENDO_DS) || \ defined(OF_NINTENDO_3DS) @try { return OFApplicationMain(&argc, &argv, [[TestsAppDelegate alloc] init]); } @catch (id e) { OFString *string = [OFString stringWithFormat: @"\nRuntime error: Unhandled exception:\n%@\n", e]; OFString *backtrace = [OFString stringWithFormat: @"\nBacktrace:\n %@\n\n", [[e backtrace] componentsJoinedByString: @"\n "]]; [OFStdOut setForegroundColor: [OFColor red]]; [OFStdOut writeString: string]; [OFStdOut writeString: backtrace]; # if defined(OF_WII) [OFStdOut reset]; [OFStdOut 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) [OFStdOut reset]; [OFStdOut writeString: @"Press start button to exit!"]; for (;;) { swiWaitForVBlank(); scanKeys(); if (keysDown() & KEY_START) [OFApplication terminateWithStatus: 1]; } # elif defined(OF_NINTENDO_3DS) [OFStdOut reset]; [OFStdOut writeString: @"Press start button to exit!"]; for (;;) { hidScanInput(); if (hidKeysDown() & KEY_START) [OFApplication terminateWithStatus: 1]; gspWaitForVBlank(); } # else abort(); # endif } #else return OFApplicationMain(&argc, &argv, [[TestsAppDelegate alloc] init]); #endif } @implementation TestsAppDelegate - (void)outputTesting: (OFString *)test inModule: (OFString *)module { if (OFStdOut.hasTerminal) { [OFStdOut setForegroundColor: [OFColor yellow]]; [OFStdOut writeFormat: @"[%@] %@: testing...", module, test]; } else [OFStdOut writeFormat: @"[%@] %@: ", module, test]; } - (void)outputSuccess: (OFString *)test inModule: (OFString *)module { if (OFStdOut.hasTerminal) { [OFStdOut setForegroundColor: [OFColor lime]]; [OFStdOut eraseLine]; [OFStdOut writeFormat: @"\r[%@] %@: ok\n", module, test]; } else [OFStdOut writeLine: @"ok"]; } - (void)outputFailure: (OFString *)test inModule: (OFString *)module { if (OFStdOut.hasTerminal) { [OFStdOut setForegroundColor: [OFColor red]]; [OFStdOut eraseLine]; [OFStdOut writeFormat: @"\r[%@] %@: failed\n", module, test]; #ifdef OF_WII [OFStdOut reset]; [OFStdOut writeLine: @"Press A to continue!"]; for (;;) { WPAD_ScanPads(); if (WPAD_ButtonsDown(0) & WPAD_BUTTON_A) return; VIDEO_WaitVSync(); } #endif #ifdef OF_PSP [OFStdOut reset]; [OFStdOut 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 [OFStdOut reset]; [OFStdOut writeString: @"Press A to continue!"]; for (;;) { swiWaitForVBlank(); scanKeys(); if (keysDown() & KEY_A) break; } #endif #ifdef OF_NINTENDO_3DS [OFStdOut reset]; [OFStdOut writeString: @"Press A to continue!"]; for (;;) { hidScanInput(); if (hidKeysDown() & KEY_A) break; gspWaitForVBlank(); } #endif [OFStdOut writeString: @"\r"]; [OFStdOut reset]; [OFStdOut eraseLine]; } else [OFStdOut writeLine: @"failed"]; } - (void)applicationDidFinishLaunching { #if defined(OF_IOS) && defined(OF_HAVE_FILES) CFBundleRef mainBundle = CFBundleGetMainBundle(); CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); UInt8 resourcesPath[PATH_MAX]; if (!CFURLGetFileSystemRepresentation(resourcesURL, true, resourcesPath, PATH_MAX)) { [OFStdErr writeString: @"Failed to locate resources!\n"]; [OFApplication terminateWithStatus: 1]; } [[OFFileManager defaultManager] changeCurrentDirectoryPath: [OFString stringWithUTF8String: (const char *)resourcesPath]]; #endif #if defined(OF_WII) && defined(OF_HAVE_FILES) |
︙ | ︙ | |||
389 390 391 392 393 394 395 | #ifdef OF_HAVE_SOCKETS [self DNSResolverTests]; #endif [self systemInfoTests]; [self localeTests]; | | | | | | | | 390 391 392 393 394 395 396 397 398 399 400 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 | #ifdef OF_HAVE_SOCKETS [self DNSResolverTests]; #endif [self systemInfoTests]; [self localeTests]; [OFStdOut reset]; #if defined(OF_IOS) [OFStdOut writeFormat: @"%d tests failed!", _fails]; [OFApplication terminateWithStatus: _fails]; #elif defined(OF_WII) [OFStdOut 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) [OFStdOut writeFormat: @"%d tests failed!", _fails]; sceKernelSleepThreadCB(); #elif defined(OF_NINTENDO_DS) [OFStdOut writeString: @"Press start button to exit!"]; for (;;) { swiWaitForVBlank(); scanKeys(); if (keysDown() & KEY_START) [OFApplication terminateWithStatus: _fails]; } #elif defined(OF_NINTENDO_3DS) [OFStdOut writeString: @"Press start button to exit!"]; for (;;) { hidScanInput(); if (hidKeysDown() & KEY_START) [OFApplication terminateWithStatus: _fails]; |
︙ | ︙ |