Use correct RE for floating point numbers in reporter_output_test.cc

This commit is contained in:
Eric Fiselier 2016-10-07 21:56:22 -06:00
parent 332f677b8b
commit 2555035f44
3 changed files with 6 additions and 5 deletions

View File

@ -16,7 +16,7 @@ int AddComplexityTest(std::string big_o_test_name, std::string rms_test_name,
std::string big_o) {
SetSubstitutions({{"%bigo_name", big_o_test_name},
{"%rms_name", rms_test_name},
{"%bigo_str", "[ ]*" + std::string(dec_re) + " " + big_o},
{"%bigo_str", "[ ]* %float " + big_o},
{"%bigo", big_o},
{"%rms", "[ ]*[0-9]+ %"}});
AddCases(

View File

@ -160,16 +160,17 @@ int AddCases(TestCaseID ID, std::initializer_list<TestCase> il) {
int SetSubstitutions(
std::initializer_list<std::pair<std::string, std::string>> il) {
auto& subs = internal::GetSubstitutions();
for (auto const& KV : il) {
for (auto KV : il) {
bool exists = false;
KV.second = internal::PerformSubstitutions(KV.second);
for (auto& EKV : subs) {
if (EKV.first == KV.first) {
EKV.second = KV.second;
EKV.second = std::move(KV.second);
exists = true;
break;
}
}
if (!exists) subs.push_back(KV);
if (!exists) subs.push_back(std::move(KV));
}
return 0;
}

View File

@ -61,7 +61,7 @@ void BM_Complexity_O1(benchmark::State& state) {
state.SetComplexityN(state.range(0));
}
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]+ %"}});
ADD_CASES(TC_ConsoleOut, {{"^BM_Complexity_O1_BigO %bigOStr %bigOStr[ ]*$"},
{"^BM_Complexity_O1_RMS %RMS %RMS[ ]*$"}});