Skip to content

Commit 4686610

Browse files
feat(core): add tests for type double colon escape
1 parent c2668c3 commit 4686610

File tree

3 files changed

+52
-2
lines changed

3 files changed

+52
-2
lines changed

core/test/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ FetchContent_MakeAvailable(googletest)
88

99
add_executable(unit_tests
1010
uri.cpp
11+
codspeed.cpp
1112
)
1213

1314
target_link_libraries(unit_tests
@@ -19,4 +20,3 @@ target_link_libraries(unit_tests
1920

2021
include(GoogleTest)
2122
gtest_discover_tests(unit_tests)
22-

core/test/codspeed.cpp

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#include "codspeed.h"
2+
#include <gtest/gtest.h>
3+
4+
// Manual definition (to avoid including it in the public header):
5+
6+
TEST(CodSpeedTest, TestSearchAndReplaceBetweenBracketsNamespace) {
7+
std::string no_brackets_input =
8+
"examples/google_benchmark/main.cpp::BM_rand_vector";
9+
std::string no_brackets_output =
10+
"examples/google_benchmark/main.cpp::BM_rand_vector";
11+
EXPECT_EQ(sanitize_bench_args(no_brackets_input), no_brackets_output);
12+
13+
std::string brackets_and_no_escaped_type_input =
14+
"examples/google_benchmark/"
15+
"template_bench.hpp::BM_Template1_Capture[two_type_test, int, double]";
16+
std::string brackets_and_no_escaped_type_output =
17+
"examples/google_benchmark/"
18+
"template_bench.hpp::BM_Template1_Capture[two_type_test, int, double]";
19+
EXPECT_EQ(sanitize_bench_args(brackets_and_no_escaped_type_input),
20+
brackets_and_no_escaped_type_output);
21+
22+
std::string brackets_and_escaped_type_input =
23+
"examples/google_benchmark/"
24+
"template_bench.hpp::test::BM_Template[std::string]";
25+
std::string brackets_and_escaped_type_output =
26+
"examples/google_benchmark/"
27+
"template_bench.hpp::test::BM_Template[std\\:\\:string]";
28+
29+
EXPECT_EQ(sanitize_bench_args(brackets_and_escaped_type_input),
30+
brackets_and_escaped_type_output);
31+
32+
std::string brackets_and_escaped_types_input =
33+
"examples/google_benchmark/"
34+
"template_bench.hpp::test::BM_Template[std::string, std::string]";
35+
std::string brackets_and_escaped_types_output =
36+
"examples/google_benchmark/"
37+
"template_bench.hpp::test::BM_Template[std\\:\\:string, std\\:\\:string]";
38+
39+
EXPECT_EQ(sanitize_bench_args(brackets_and_escaped_types_input),
40+
brackets_and_escaped_types_output);
41+
42+
std::string brackets_and_multiple_types_input =
43+
"examples/google_benchmark/"
44+
"template_bench.hpp::test::BM_Template[std::string, int, double]";
45+
std::string brackets_and_multiple_types_output =
46+
"examples/google_benchmark/"
47+
"template_bench.hpp::test::BM_Template[std\\:\\:string, int, double]";
48+
49+
EXPECT_EQ(sanitize_bench_args(brackets_and_multiple_types_input),
50+
brackets_and_multiple_types_output);
51+
}

core/test/uri.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
#include <gtest/gtest.h>
32
#include "codspeed.h"
43

0 commit comments

Comments
 (0)