2017-10-31 01:47:55 -07:00
|
|
|
const std = @import("std");
|
|
|
|
const io = std.io;
|
2017-05-01 10:12:38 -07:00
|
|
|
const builtin = @import("builtin");
|
|
|
|
const test_fn_list = builtin.__zig_test_fn_slice;
|
2017-10-31 01:47:55 -07:00
|
|
|
const warn = std.debug.warn;
|
2016-02-03 17:02:01 -08:00
|
|
|
|
2018-01-30 22:51:15 -08:00
|
|
|
pub fn main() !void {
|
2018-07-21 20:43:43 -07:00
|
|
|
var ok_count: usize = 0;
|
|
|
|
var skip_count: usize = 0;
|
2017-04-27 13:15:41 -07:00
|
|
|
for (test_fn_list) |test_fn, i| {
|
2017-10-31 01:47:55 -07:00
|
|
|
warn("Test {}/{} {}...", i + 1, test_fn_list.len, test_fn.name);
|
2016-02-03 17:02:01 -08:00
|
|
|
|
2018-07-21 20:43:43 -07:00
|
|
|
if (test_fn.func()) |_| {
|
|
|
|
ok_count += 1;
|
|
|
|
warn("OK\n");
|
|
|
|
} else |err| switch (err) {
|
|
|
|
error.SkipZigTest => {
|
|
|
|
skip_count += 1;
|
|
|
|
warn("SKIP\n");
|
|
|
|
},
|
|
|
|
else => return err,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ok_count == test_fn_list.len) {
|
|
|
|
warn("All tests passed.\n");
|
|
|
|
} else {
|
|
|
|
warn("{} passed; {} skipped.\n", ok_count, skip_count);
|
2016-02-03 17:02:01 -08:00
|
|
|
}
|
|
|
|
}
|