@@ -10,15 +10,14 @@ std::string Translate(std::string code){
10
10
declarations = " " ;
11
11
enums = " " ;
12
12
auto * action = new ExampleFrontendAction;
13
- clang::tooling::runToolOnCode (action, code);
13
+ clang::tooling::runToolOnCode (action, code, " input.h " );
14
14
return declarations;
15
15
}
16
16
17
17
TEST_CASE (" native types" , " [Type]" ) {
18
18
19
19
std::map<std::string, std::string> types = {
20
20
{" void" , " Unit" },
21
- // {"bool", "native.CBool"},
22
21
{" char" , " native.CChar" },
23
22
{" signed char" , " native.CSignedChar" },
24
23
{" unsigned char" , " native.CUnsignedChar" },
@@ -32,8 +31,8 @@ TEST_CASE("native types", "[Type]" ) {
32
31
{" unsigned long" , " native.CUnsignedLong" },
33
32
{" long long" , " native.CLongLong" },
34
33
{" unsigned long long" , " native.CUnsignedLongLong" },
35
- // {"size_t", "native.CSize"},
36
- // {"ptrdiff_t", "native.CPtrDiff"},
34
+ {" size_t" , " native.CSize" },
35
+ {" ptrdiff_t" , " native.CPtrDiff" },
37
36
{" wchar_t" , " native.CWideChar" },
38
37
{" char16_t" , " native.CChar16" },
39
38
{" char32_t" , " native.CChar32" },
@@ -47,10 +46,9 @@ TEST_CASE("native types", "[Type]" ) {
47
46
};
48
47
49
48
for (const auto & kv: types){
50
- std::string code = " typedef " + kv.first + " a;\n " ;
49
+ std::string code = " #include<uchar.h> \n #include<stddef.h> \n typedef " + kv.first + " a;\n " ;
51
50
std::string answer = " \t type a = " + kv.second + " \n " ;
52
51
53
52
REQUIRE (answer == Translate (code));
54
53
}
55
-
56
- }
54
+ }
0 commit comments