summaryrefslogtreecommitdiff
path: root/tools/slang-test/test-reporter.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-02-24 15:43:43 -0800
committerGitHub <noreply@github.com>2021-02-24 15:43:43 -0800
commit9b7a007c31072bc9aebd1134aa4f1bfd28a4c541 (patch)
treeb71a48eb30b3b09ab4e77e40dc1c68ecd854ef82 /tools/slang-test/test-reporter.cpp
parentd66b30729029bdb43892e05c9c80fd56ac95a24f (diff)
Explicit swapchain interface in `gfx`. (#1726)
* Explicit swapchain interface in `gfx`. * Correctly return nullptr when `IRenderer` creation failed. * Fix crashes on CUDA tests. * Cleanups.
Diffstat (limited to 'tools/slang-test/test-reporter.cpp')
-rw-r--r--tools/slang-test/test-reporter.cpp48
1 files changed, 29 insertions, 19 deletions
diff --git a/tools/slang-test/test-reporter.cpp b/tools/slang-test/test-reporter.cpp
index fd9748b28..4a7c76c4c 100644
--- a/tools/slang-test/test-reporter.cpp
+++ b/tools/slang-test/test-reporter.cpp
@@ -314,28 +314,38 @@ void TestReporter::_addResult(const TestInfo& info)
m_testInfos.add(info);
- // printf("OUTPUT_MODE: %d\n", options.outputMode);
- switch (m_outputMode)
+ auto defaultOutputFunc = [](const TestInfo& info)
{
+ char const* resultString = "UNEXPECTED";
+ switch (info.testResult)
+ {
+ case TestResult::Fail:
+ resultString = "FAILED";
+ break;
+ case TestResult::Pass:
+ resultString = "passed";
+ break;
+ case TestResult::Ignored:
+ resultString = "ignored";
+ break;
default:
+ assert(!"unexpected");
+ break;
+ }
+
+ StringBuilder buffer;
+ if (info.executionTime > 0.0f)
{
- char const* resultString = "UNEXPECTED";
- switch (info.testResult)
- {
- case TestResult::Fail: resultString = "FAILED"; break;
- case TestResult::Pass: resultString = "passed"; break;
- case TestResult::Ignored: resultString = "ignored"; break;
- default:
- assert(!"unexpected");
- break;
- }
+ _appendTime(info.executionTime, buffer);
+ }
+ printf("%s test: '%S' %s\n", resultString, info.name.toWString().begin(), buffer.getBuffer());
+ };
- StringBuilder buffer;
- if (info.executionTime > 0.0f)
- {
- _appendTime(info.executionTime, buffer);
- }
- printf("%s test: '%S' %s\n", resultString, info.name.toWString().begin(), buffer.getBuffer());
+ switch (m_outputMode)
+ {
+ default:
+ {
+ defaultOutputFunc(info);
break;
}
case TestOutputMode::TeamCity:
@@ -464,7 +474,7 @@ void TestReporter::_addResult(const TestInfo& info)
exeRes.standardError.begin());
#endif
}
-
+ defaultOutputFunc(info);
break;
}
}