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
|
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
|
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
|
inClass: (Class)class
status: (enum Status)status
description: (OFString *)description
{
switch (status) {
case StatusRunning:
if (OFStdOut.hasTerminal) {
[OFStdOut setForegroundColor: [OFColor olive]];
OFStdOut.foregroundColor = [OFColor olive];
[OFStdOut writeFormat: @"-[%@ ", class];
[OFStdOut setForegroundColor: [OFColor yellow]];
OFStdOut.foregroundColor = [OFColor yellow];
[OFStdOut writeFormat: @"%s", sel_getName(test)];
[OFStdOut setForegroundColor: [OFColor olive]];
OFStdOut.foregroundColor = [OFColor olive];
[OFStdOut writeString: @"]: "];
} else
[OFStdOut writeFormat: @"-[%@ %s]: ",
class, sel_getName(test)];
break;
case StatusOk:
if (OFStdOut.hasTerminal) {
[OFStdOut setCursorColumn: 0];
[OFStdOut eraseLine];
[OFStdOut setForegroundColor: [OFColor green]];
OFStdOut.foregroundColor = [OFColor green];
[OFStdOut writeFormat: @"-[%@ ", class];
[OFStdOut setForegroundColor: [OFColor lime]];
OFStdOut.foregroundColor = [OFColor lime];
[OFStdOut writeFormat: @"%s", sel_getName(test)];
[OFStdOut setForegroundColor: [OFColor green]];
OFStdOut.foregroundColor = [OFColor green];
[OFStdOut writeLine: @"]: ok"];
} else
[OFStdOut writeLine: @"ok"];
break;
case StatusFailed:
if (OFStdOut.hasTerminal) {
[OFStdOut setCursorColumn: 0];
[OFStdOut eraseLine];
[OFStdOut setForegroundColor: [OFColor maroon]];
OFStdOut.foregroundColor = [OFColor maroon];
[OFStdOut writeFormat: @"-[%@ ", class];
[OFStdOut setForegroundColor: [OFColor red]];
OFStdOut.foregroundColor = [OFColor red];
[OFStdOut writeFormat: @"%s", sel_getName(test)];
[OFStdOut setForegroundColor: [OFColor maroon]];
OFStdOut.foregroundColor = [OFColor maroon];
[OFStdOut writeLine: @"]: failed"];
} else
[OFStdOut writeLine: @"failed"];
if (description != nil)
[OFStdOut writeLine: description];
break;
case StatusSkipped:
if (OFStdOut.hasTerminal) {
[OFStdOut setCursorColumn: 0];
[OFStdOut eraseLine];
[OFStdOut setForegroundColor: [OFColor gray]];
OFStdOut.foregroundColor = [OFColor gray];
[OFStdOut writeFormat: @"-[%@ ", class];
[OFStdOut setForegroundColor: [OFColor silver]];
OFStdOut.foregroundColor = [OFColor silver];
[OFStdOut writeFormat: @"%s", sel_getName(test)];
[OFStdOut setForegroundColor: [OFColor gray]];
OFStdOut.foregroundColor = [OFColor gray];
[OFStdOut writeLine: @"]: skipped"];
} else
[OFStdOut writeLine: @"skipped"];
if (description != nil)
[OFStdOut writeLine: description];
break;
}
if (status == StatusFailed) {
#if defined(OF_WII) || defined(OF_NINTENDO_DS) || defined(OF_NINTENDO_3DS) || \
defined(OF_NINTENDO_SWITCH)
[OFStdOut setForegroundColor: [OFColor silver]];
OFStdOut.foregroundColor = [OFColor silver];
[OFStdOut writeLine: @"Press A to continue"];
# ifdef OF_NINTENDO_SWITCH
while (appletMainLoop()) {
# else
for (;;) {
# endif
|
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
|
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
|
-
+
-
+
-
+
-
+
-
+
|
}
[testClasses addObject: class];
}
} else
testClasses = [self testClasses];
[OFStdOut setForegroundColor: [OFColor purple]];
OFStdOut.foregroundColor = [OFColor purple];
[OFStdOut writeString: @"Running "];
[OFStdOut setForegroundColor: [OFColor fuchsia]];
OFStdOut.foregroundColor = [OFColor fuchsia];
[OFStdOut writeFormat: @"%zu", testClasses.count];
[OFStdOut setForegroundColor: [OFColor purple]];
OFStdOut.foregroundColor = [OFColor purple];
[OFStdOut writeFormat: @" test case%s\n",
(testClasses.count != 1 ? "s" : "")];
for (Class class in testClasses) {
OFArray *summary;
[OFStdOut setForegroundColor: [OFColor teal]];
OFStdOut.foregroundColor = [OFColor teal];
[OFStdOut writeFormat: @"Running ", class];
[OFStdOut setForegroundColor: [OFColor aqua]];
OFStdOut.foregroundColor = [OFColor aqua];
[OFStdOut writeFormat: @"%@\n", class];
for (OFValue *test in [self testsInClass: class]) {
void *pool = objc_autoreleasePoolPush();
bool failed = false, skipped = false;
OTTestCase *instance;
|
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
|
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
|
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
|
if (summary != nil)
[summaries setObject: summary forKey: class];
}
for (Class class in summaries) {
OFArray *summary = [summaries objectForKey: class];
[OFStdOut setForegroundColor: [OFColor teal]];
OFStdOut.foregroundColor = [OFColor teal];
[OFStdOut writeString: @"Summary for "];
[OFStdOut setForegroundColor: [OFColor aqua]];
OFStdOut.foregroundColor = [OFColor aqua];
[OFStdOut writeFormat: @"%@\n", class];
for (OFPair *line in summary) {
[OFStdOut setForegroundColor: [OFColor navy]];
OFStdOut.foregroundColor = [OFColor navy];
[OFStdOut writeFormat: @"%@: ", line.firstObject];
[OFStdOut setForegroundColor: [OFColor blue]];
OFStdOut.foregroundColor = [OFColor blue];
[OFStdOut writeFormat: @"%@\n", line.secondObject];
}
}
[OFStdOut setForegroundColor: [OFColor fuchsia]];
OFStdOut.foregroundColor = [OFColor fuchsia];
[OFStdOut writeFormat: @"%zu", numSucceeded];
[OFStdOut setForegroundColor: [OFColor purple]];
OFStdOut.foregroundColor = [OFColor purple];
[OFStdOut writeFormat: @" test%s succeeded, ",
(numSucceeded != 1 ? "s" : "")];
[OFStdOut setForegroundColor: [OFColor fuchsia]];
OFStdOut.foregroundColor = [OFColor fuchsia];
[OFStdOut writeFormat: @"%zu", numFailed];
[OFStdOut setForegroundColor: [OFColor purple]];
OFStdOut.foregroundColor = [OFColor purple];
[OFStdOut writeFormat: @" test%s failed, ",
(numFailed != 1 ? "s" : "")];
[OFStdOut setForegroundColor: [OFColor fuchsia]];
OFStdOut.foregroundColor = [OFColor fuchsia];
[OFStdOut writeFormat: @"%zu", numSkipped];
[OFStdOut setForegroundColor: [OFColor purple]];
OFStdOut.foregroundColor = [OFColor purple];
[OFStdOut writeFormat: @" test%s skipped\n",
(numSkipped != 1 ? "s" : "")];
[OFStdOut reset];
#if defined(OF_WII) || defined(OF_NINTENDO_DS) || defined(OF_NINTENDO_3DS)
[OFStdOut setForegroundColor: [OFColor silver]];
OFStdOut.foregroundColor = [OFColor silver];
# ifdef OF_WII
[OFStdOut writeLine: @"Press Home button to exit"];
# else
[OFStdOut writeLine: @"Press Start button to exit"];
# endif
for (;;) {
|