|
| 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 | +} |
0 commit comments