Address review feedback

Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
This commit is contained in:
Nicholas Van Sickle
2022-01-27 13:15:30 -08:00
parent e06b8782cc
commit 73f166241e
6 changed files with 143 additions and 62 deletions
@@ -96,4 +96,25 @@ namespace AZ::Dom::Benchmark
state.SetItemsProcessed(3 * state.iterations());
}
BENCHMARK_REGISTER_F(DomPathBenchmark, DomPathEntry_IsEndOfArray);
BENCHMARK_DEFINE_F(DomPathBenchmark, DomPathEntry_Comparison)(benchmark::State& state)
{
PathEntry name("name");
PathEntry index(0);
PathEntry endOfArray;
endOfArray.SetEndOfArray();
for (auto _ : state)
{
name == name;
name == index;
name == endOfArray;
index == index;
index == endOfArray;
endOfArray == endOfArray;
}
state.SetItemsProcessed(6 * state.iterations());
}
BENCHMARK_REGISTER_F(DomPathBenchmark, DomPathEntry_Comparison);
}
@@ -174,4 +174,23 @@ namespace AZ::Dom::Tests
p.AppendToString(s);
EXPECT_EQ(s, "/foo/0/foo/0");
}
TEST_F(DomPathTests, MixedPath_AppendToFixedString)
{
Path p("/foo/0");
{
AZStd::fixed_string<7> s;
p.AppendToString(s);
EXPECT_EQ(s, "/foo/0");
}
{
AZStd::fixed_string<9> s;
p.AppendToString(s);
EXPECT_EQ(s, "/foo/0");
p.AppendToString(s);
EXPECT_EQ(s, "/foo/0/fo");
}
}
} // namespace AZ::Dom::Tests