Skip to content

Commit e8b496f

Browse files
committed
Improve PerfTests
1 parent 0bd1418 commit e8b496f

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

test/perf_test.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@ TEST(PerfTests, SimpleSubstituteText)
4545
std::cout << result << std::endl;
4646
}
4747

48+
TEST(PerfTests, ValueSubstituteText)
49+
{
50+
std::string source = "{{ message }} from Parser!";
51+
52+
Template tpl;
53+
ASSERT_TRUE(tpl.Load(source));
54+
55+
jinja2::ValuesMap params = {{"message", 100500}};
56+
57+
std::cout << tpl.RenderAsString(params) << std::endl;
58+
std::string result;
59+
for (int n = 0; n < Iterations * 100; ++ n)
60+
result = tpl.RenderAsString(params);
61+
62+
std::cout << result << std::endl;
63+
}
64+
4865
TEST(PerfTests, SimpleSubstituteFilterText)
4966
{
5067
std::string source = "{{ message | upper }} from Parser!";
@@ -116,7 +133,7 @@ TEST(PerfTests, ForLoopParamText)
116133

117134
TEST(PerfTests, ForLoopIndexText)
118135
{
119-
std::string source = "{% for i in range(20)%} {{i}}-{{loop.index}} {%endfor%}";
136+
std::string source = "{% for i in range(20)%} {{i ~ '-' ~ loop.index}} {%endfor%}";
120137

121138
Template tpl;
122139
ASSERT_TRUE(tpl.Load(source));

thirdparty/nonstd/expected-light

0 commit comments

Comments
 (0)