| 6 | using namespace megcc::KernelGen; |
| 7 | |
| 8 | TEST(TOOLS, RenderStr) { |
| 9 | std::string temp_str = R"( |
| 10 | int haha = ${val0}; |
| 11 | ${val1}wawa; |
| 12 | ${val2};kaka |
| 13 | )"; |
| 14 | std::string target_str = R"( |
| 15 | int haha = 1234; |
| 16 | 5678wawa; |
| 17 | 9;kaka |
| 18 | )"; |
| 19 | StringTemplate::KvMap kv_map; |
| 20 | kv_map["val0"] = "1234"; |
| 21 | kv_map["val1"] = "5678"; |
| 22 | kv_map["val2"] = "9"; |
| 23 | auto res = StringTemplate::render(temp_str, kv_map); |
| 24 | EXPECT_TRUE(res == target_str); |
| 25 | } |
| 26 | |
| 27 | TEST(TOOLS, RenderStrFunc) { |
| 28 | std::string temp_str = R"( |
nothing calls this directly
no test coverage detected