mirror of
https://github.com/google/benchmark.git
synced 2025-02-21 08:40:17 +08:00
Use correct RE for floating point numbers in reporter_output_test.cc
This commit is contained in:
parent
332f677b8b
commit
2555035f44
@ -16,7 +16,7 @@ int AddComplexityTest(std::string big_o_test_name, std::string rms_test_name,
|
|||||||
std::string big_o) {
|
std::string big_o) {
|
||||||
SetSubstitutions({{"%bigo_name", big_o_test_name},
|
SetSubstitutions({{"%bigo_name", big_o_test_name},
|
||||||
{"%rms_name", rms_test_name},
|
{"%rms_name", rms_test_name},
|
||||||
{"%bigo_str", "[ ]*" + std::string(dec_re) + " " + big_o},
|
{"%bigo_str", "[ ]* %float " + big_o},
|
||||||
{"%bigo", big_o},
|
{"%bigo", big_o},
|
||||||
{"%rms", "[ ]*[0-9]+ %"}});
|
{"%rms", "[ ]*[0-9]+ %"}});
|
||||||
AddCases(
|
AddCases(
|
||||||
|
@ -160,16 +160,17 @@ int AddCases(TestCaseID ID, std::initializer_list<TestCase> il) {
|
|||||||
int SetSubstitutions(
|
int SetSubstitutions(
|
||||||
std::initializer_list<std::pair<std::string, std::string>> il) {
|
std::initializer_list<std::pair<std::string, std::string>> il) {
|
||||||
auto& subs = internal::GetSubstitutions();
|
auto& subs = internal::GetSubstitutions();
|
||||||
for (auto const& KV : il) {
|
for (auto KV : il) {
|
||||||
bool exists = false;
|
bool exists = false;
|
||||||
|
KV.second = internal::PerformSubstitutions(KV.second);
|
||||||
for (auto& EKV : subs) {
|
for (auto& EKV : subs) {
|
||||||
if (EKV.first == KV.first) {
|
if (EKV.first == KV.first) {
|
||||||
EKV.second = KV.second;
|
EKV.second = std::move(KV.second);
|
||||||
exists = true;
|
exists = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!exists) subs.push_back(KV);
|
if (!exists) subs.push_back(std::move(KV));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ void BM_Complexity_O1(benchmark::State& state) {
|
|||||||
state.SetComplexityN(state.range(0));
|
state.SetComplexityN(state.range(0));
|
||||||
}
|
}
|
||||||
BENCHMARK(BM_Complexity_O1)->Range(1, 1 << 18)->Complexity(benchmark::o1);
|
BENCHMARK(BM_Complexity_O1)->Range(1, 1 << 18)->Complexity(benchmark::o1);
|
||||||
SET_SUBSTITUTIONS({{"%bigOStr", "[ ]*[0-9]+\\.[0-9]+ \\([0-9]+\\)"},
|
SET_SUBSTITUTIONS({{"%bigOStr", "[ ]* %float \\([0-9]+\\)"},
|
||||||
{"%RMS", "[ ]*[0-9]+ %"}});
|
{"%RMS", "[ ]*[0-9]+ %"}});
|
||||||
ADD_CASES(TC_ConsoleOut, {{"^BM_Complexity_O1_BigO %bigOStr %bigOStr[ ]*$"},
|
ADD_CASES(TC_ConsoleOut, {{"^BM_Complexity_O1_BigO %bigOStr %bigOStr[ ]*$"},
|
||||||
{"^BM_Complexity_O1_RMS %RMS %RMS[ ]*$"}});
|
{"^BM_Complexity_O1_RMS %RMS %RMS[ ]*$"}});
|
||||||
|
Loading…
Reference in New Issue
Block a user