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
|
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
|
-
+
-
+
-
+
|
} @catch (id e) {
TestsAppDelegate *delegate =
[[OFApplication sharedApplication] delegate];
OFString *string = [OFString stringWithFormat:
@"\nRuntime error: Unhandled exception:\n%@\n", e];
[delegate outputString: string
withColor: RED];
inColor: RED];
[delegate outputString: @"Press home button to exit!\n"
withColor: NO_COLOR];
inColor: NO_COLOR];
for (;;) {
WPAD_ScanPads();
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME)
[OFApplication terminateWithStatus: 1];
VIDEO_WaitVSync();
}
}
#else
return of_application_main(&argc, &argv, [TestsAppDelegate class]);
#endif
}
@implementation TestsAppDelegate
- (void)outputString: (OFString*)str
withColor: (int)color
inColor: (int)color
{
#if defined(_PSP)
char i, space = ' ';
int y = pspDebugScreenGetY();
pspDebugScreenSetXY(0, y);
for (i = 0; i < 68; i++)
|
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
|
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
|
-
+
-
+
-
+
-
+
-
+
|
- (void)outputTesting: (OFString*)test
inModule: (OFString*)module
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
[self outputString: [OFString stringWithFormat: @"[%@] %@: testing...",
module, test]
withColor: YELLOW];
inColor: YELLOW];
[pool release];
}
- (void)outputSuccess: (OFString*)test
inModule: (OFString*)module
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
[self outputString: [OFString stringWithFormat: @"[%@] %@: ok\n",
module, test]
withColor: GREEN];
inColor: GREEN];
[pool release];
}
- (void)outputFailure: (OFString*)test
inModule: (OFString*)module
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
[self outputString: [OFString stringWithFormat: @"[%@] %@: failed\n",
module, test]
withColor: RED];
inColor: RED];
[pool release];
#ifdef __wii__
[self outputString: @"Press A to continue!\n"
withColor: NO_COLOR];
inColor: NO_COLOR];
for (;;) {
WPAD_ScanPads();
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_A)
return;
VIDEO_WaitVSync();
}
#endif
}
- (void)applicationDidFinishLaunching
{
#ifdef _PSP
pspDebugScreenInit();
#endif
#ifdef __wii__
[OFFile changeToDirectoryAtPath: @"/objfw-tests"];
[OFFile changeToDirectoryAtPath: @"/apps/objfw-tests"];
#endif
[self objectTests];
#ifdef OF_HAVE_BLOCKS
[self blockTests];
#endif
[self MD5HashTests];
|
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
-
+
|
[self forwardingTests];
#ifdef OF_HAVE_PROPERTIES
[self propertiesTests];
#endif
#ifdef __wii__
[self outputString: @"Press home button to exit!\n"
withColor: NO_COLOR];
inColor: NO_COLOR];
for (;;) {
WPAD_ScanPads();
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME)
[OFApplication terminateWithStatus: _fails];
VIDEO_WaitVSync();
}
#else
[OFApplication terminateWithStatus: _fails];
#endif
}
@end
|