summaryrefslogtreecommitdiff
path: root/source/core/slang-test-tool-util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/core/slang-test-tool-util.cpp')
-rw-r--r--source/core/slang-test-tool-util.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/source/core/slang-test-tool-util.cpp b/source/core/slang-test-tool-util.cpp
index 7ecfacefa..20ba2fc47 100644
--- a/source/core/slang-test-tool-util.cpp
+++ b/source/core/slang-test-tool-util.cpp
@@ -4,18 +4,34 @@
namespace Slang
{
-/* static */int TestToolUtil::getReturnCode(SlangResult res)
+/* static */ToolReturnCode TestToolUtil::getReturnCode(SlangResult res)
{
- if (SLANG_SUCCEEDED(res))
+ switch (res)
{
- return 0;
+ case SLANG_OK: return ToolReturnCode::Success;
+ case SLANG_E_INTERNAL_FAIL: return ToolReturnCode::CompilationFailed;
+ case SLANG_FAIL: return ToolReturnCode::Failed;
+ case SLANG_E_NOT_AVAILABLE: return ToolReturnCode::Ignored;
+ default:
+ {
+ return (SLANG_SUCCEEDED(res)) ? ToolReturnCode::Success : ToolReturnCode::Failed;
+ }
}
- else if (res == SLANG_E_INTERNAL_FAIL)
+}
+
+/* static */ToolReturnCode TestToolUtil::getReturnCodeFromInt(int code)
+{
+ if (code >= int(ToolReturnCodeSpan::First) && code <= int(ToolReturnCodeSpan::Last))
{
- return -1;
+ return ToolReturnCode(code);
+ }
+ else
+ {
+ SLANG_ASSERT(!"Invalid integral code");
+ return ToolReturnCode::Failed;
}
- return 1;
}
+
}