@@ -49,10 +49,12 @@ # 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(); @@ -88,11 +90,11 @@ */ atexit(objc_exit); #endif /* We need deterministic hashes for tests */ - of_hash_seed = 0; + OFHashSeed = 0; #ifdef OF_WII GXRModeObj *rmode; void *xfb; @@ -137,26 +139,26 @@ #endif #if defined(OF_WII) || defined(OF_PSP) || defined(OF_NINTENDO_DS) || \ defined(OF_NINTENDO_3DS) @try { - return of_application_main(&argc, &argv, + 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 "]]; - [of_stdout setForegroundColor: [OFColor red]]; - [of_stdout writeString: string]; - [of_stdout writeString: backtrace]; + [OFStdOut setForegroundColor: [OFColor red]]; + [OFStdOut writeString: string]; + [OFStdOut writeString: backtrace]; # if defined(OF_WII) - [of_stdout reset]; - [of_stdout writeString: @"Press home button to exit!"]; + [OFStdOut reset]; + [OFStdOut writeString: @"Press home button to exit!"]; for (;;) { WPAD_ScanPads(); if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) @@ -165,22 +167,22 @@ VIDEO_WaitVSync(); } # elif defined(OF_PSP) sceKernelSleepThreadCB(); # elif defined(OF_NINTENDO_DS) - [of_stdout reset]; - [of_stdout writeString: @"Press start button to exit!"]; + [OFStdOut reset]; + [OFStdOut 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!"]; + [OFStdOut reset]; + [OFStdOut writeString: @"Press start button to exit!"]; for (;;) { hidScanInput(); if (hidKeysDown() & KEY_START) @@ -191,48 +193,47 @@ # else abort(); # endif } #else - return of_application_main(&argc, &argv, - [[TestsAppDelegate alloc] init]); + return OFApplicationMain(&argc, &argv, [[TestsAppDelegate alloc] init]); #endif } @implementation TestsAppDelegate - (void)outputTesting: (OFString *)test inModule: (OFString *)module { - if (of_stdout.hasTerminal) { - [of_stdout setForegroundColor: [OFColor yellow]]; - [of_stdout writeFormat: @"[%@] %@: testing...", module, test]; + if (OFStdOut.hasTerminal) { + [OFStdOut setForegroundColor: [OFColor yellow]]; + [OFStdOut writeFormat: @"[%@] %@: testing...", module, test]; } else - [of_stdout writeFormat: @"[%@] %@: ", module, test]; + [OFStdOut writeFormat: @"[%@] %@: ", module, test]; } - (void)outputSuccess: (OFString *)test inModule: (OFString *)module { - if (of_stdout.hasTerminal) { - [of_stdout setForegroundColor: [OFColor lime]]; - [of_stdout eraseLine]; - [of_stdout writeFormat: @"\r[%@] %@: ok\n", module, test]; + if (OFStdOut.hasTerminal) { + [OFStdOut setForegroundColor: [OFColor lime]]; + [OFStdOut eraseLine]; + [OFStdOut writeFormat: @"\r[%@] %@: ok\n", module, test]; } else - [of_stdout writeLine: @"ok"]; + [OFStdOut writeLine: @"ok"]; } - (void)outputFailure: (OFString *)test inModule: (OFString *)module { - if (of_stdout.hasTerminal) { - [of_stdout setForegroundColor: [OFColor red]]; - [of_stdout eraseLine]; - [of_stdout writeFormat: @"\r[%@] %@: failed\n", module, test]; + if (OFStdOut.hasTerminal) { + [OFStdOut setForegroundColor: [OFColor red]]; + [OFStdOut eraseLine]; + [OFStdOut writeFormat: @"\r[%@] %@: failed\n", module, test]; #ifdef OF_WII - [of_stdout reset]; - [of_stdout writeLine: @"Press A to continue!"]; + [OFStdOut reset]; + [OFStdOut writeLine: @"Press A to continue!"]; for (;;) { WPAD_ScanPads(); if (WPAD_ButtonsDown(0) & WPAD_BUTTON_A) @@ -240,12 +241,12 @@ VIDEO_WaitVSync(); } #endif #ifdef OF_PSP - [of_stdout reset]; - [of_stdout writeLine: @"Press X to continue!"]; + [OFStdOut reset]; + [OFStdOut writeLine: @"Press X to continue!"]; for (;;) { SceCtrlData pad; sceCtrlReadBufferPositive(&pad, 1); @@ -257,23 +258,23 @@ } } } #endif #ifdef OF_NINTENDO_DS - [of_stdout reset]; - [of_stdout writeString: @"Press A to continue!"]; + [OFStdOut reset]; + [OFStdOut 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!"]; + [OFStdOut reset]; + [OFStdOut writeString: @"Press A to continue!"]; for (;;) { hidScanInput(); if (hidKeysDown() & KEY_A) @@ -281,15 +282,15 @@ gspWaitForVBlank(); } #endif - [of_stdout writeString: @"\r"]; - [of_stdout reset]; - [of_stdout eraseLine]; + [OFStdOut writeString: @"\r"]; + [OFStdOut reset]; + [OFStdOut eraseLine]; } else - [of_stdout writeLine: @"failed"]; + [OFStdOut writeLine: @"failed"]; } - (void)applicationDidFinishLaunching { #if defined(OF_IOS) && defined(OF_HAVE_FILES) @@ -297,11 +298,11 @@ CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); UInt8 resourcesPath[PATH_MAX]; if (!CFURLGetFileSystemRepresentation(resourcesURL, true, resourcesPath, PATH_MAX)) { - [of_stderr writeString: @"Failed to locate resources!\n"]; + [OFStdErr writeString: @"Failed to locate resources!\n"]; [OFApplication terminateWithStatus: 1]; } [[OFFileManager defaultManager] changeCurrentDirectoryPath: [OFString stringWithUTF8String: (const char *)resourcesPath]]; @@ -379,12 +380,10 @@ #ifdef OF_HAVE_FILES [self serializationTests]; #endif [self JSONTests]; [self propertyListTests]; - [self ASN1DERParsingTests]; - [self ASN1DERRepresentationTests]; #if defined(OF_HAVE_PLUGINS) [self pluginTests]; #endif #ifdef OF_WINDOWS [self windowsRegistryKeyTests]; @@ -394,17 +393,17 @@ [self DNSResolverTests]; #endif [self systemInfoTests]; [self localeTests]; - [of_stdout reset]; + [OFStdOut reset]; #if defined(OF_IOS) - [of_stdout writeFormat: @"%d tests failed!", _fails]; + [OFStdOut writeFormat: @"%d tests failed!", _fails]; [OFApplication terminateWithStatus: _fails]; #elif defined(OF_WII) - [of_stdout writeString: @"Press home button to exit!"]; + [OFStdOut writeString: @"Press home button to exit!"]; for (;;) { WPAD_ScanPads(); if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) @@ -411,24 +410,24 @@ [OFApplication terminateWithStatus: _fails]; VIDEO_WaitVSync(); } #elif defined(OF_PSP) - [of_stdout writeFormat: @"%d tests failed!", _fails]; + [OFStdOut writeFormat: @"%d tests failed!", _fails]; sceKernelSleepThreadCB(); #elif defined(OF_NINTENDO_DS) - [of_stdout writeString: @"Press start button to exit!"]; + [OFStdOut 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!"]; + [OFStdOut writeString: @"Press start button to exit!"]; for (;;) { hidScanInput(); if (hidKeysDown() & KEY_START)