MCPcopy Create free account
hub / github.com/MegEngine/MegCC / TEST

Function TEST

compiler/test/kernel/tools/string_render.cpp:8–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6using namespace megcc::KernelGen;
7
8TEST(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
27TEST(TOOLS, RenderStrFunc) {
28 std::string temp_str = R"(

Callers

nothing calls this directly

Calls 3

StringTemplateArgsClass · 0.85
renderMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected