|
|
@ -421,6 +421,10 @@ local function wrap_test(func)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local function get_elapsed_str(elapsed)
|
|
|
|
|
|
|
|
return elapsed < 1 and "<1" or tostring(elapsed)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local function run_test(test, status, counts)
|
|
|
|
local function run_test(test, status, counts)
|
|
|
|
test.private.checks = 0
|
|
|
|
test.private.checks = 0
|
|
|
|
test.private.checks_ok = 0
|
|
|
|
test.private.checks_ok = 0
|
|
|
@ -437,7 +441,8 @@ local function run_test(test, status, counts)
|
|
|
|
elseif test.private.checks ~= test.private.checks_ok then
|
|
|
|
elseif test.private.checks ~= test.private.checks_ok then
|
|
|
|
dfhack.printerr('test failed: ' .. test.name)
|
|
|
|
dfhack.printerr('test failed: ' .. test.name)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
print(('test passed in %d ms: %s'):format(elapsed_ms, test.name))
|
|
|
|
local elapsed_str = get_elapsed_str(elapsed_ms)
|
|
|
|
|
|
|
|
print(('test passed in %s ms: %s'):format(elapsed_str, test.name))
|
|
|
|
passed = true
|
|
|
|
passed = true
|
|
|
|
counts.tests_ok = counts.tests_ok + 1
|
|
|
|
counts.tests_ok = counts.tests_ok + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -551,7 +556,7 @@ local function run_tests(tests, status, counts, config)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
status['*'] = status['*'] or TestStatus.PASSED
|
|
|
|
status['*'] = status['*'] or TestStatus.PASSED
|
|
|
|
print(('\nTests completed in %d ms:'):format(elapsed_ms))
|
|
|
|
print(('\nTests completed in %s ms:'):format(get_elapsed_str(elapsed_ms)))
|
|
|
|
print_summary_line(counts.tests_ok == counts.tests,
|
|
|
|
print_summary_line(counts.tests_ok == counts.tests,
|
|
|
|
('%d/%d tests passed'):format(counts.tests_ok, counts.tests))
|
|
|
|
('%d/%d tests passed'):format(counts.tests_ok, counts.tests))
|
|
|
|
print_summary_line(counts.checks_ok == counts.checks,
|
|
|
|
print_summary_line(counts.checks_ok == counts.checks,
|
|
|
|