blob: 20ba2fc47c4e98afe43c1738218e183914adbeb1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#include "slang-test-tool-util.h"
namespace Slang
{
/* static */ToolReturnCode TestToolUtil::getReturnCode(SlangResult res)
{
switch (res)
{
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;
}
}
}
/* static */ToolReturnCode TestToolUtil::getReturnCodeFromInt(int code)
{
if (code >= int(ToolReturnCodeSpan::First) && code <= int(ToolReturnCodeSpan::Last))
{
return ToolReturnCode(code);
}
else
{
SLANG_ASSERT(!"Invalid integral code");
return ToolReturnCode::Failed;
}
}
}
|