diff options
author | Marek Kurdej <marek@quasardb.net> | 2016-10-21 14:59:06 +0200 |
---|---|---|
committer | Marek Kurdej <marek@quasardb.net> | 2016-10-21 14:59:06 +0200 |
commit | 8aeb20f16b7d539e3d3cf857fb4c82bf56d1a605 (patch) | |
tree | ccf0b46309209d1f9c7b05c6d6afe64dbe0e61e7 /test | |
parent | 5aa385562739652eddfd018d84e5d43c5c4777b8 (diff) | |
download | google-benchmark-8aeb20f16b7d539e3d3cf857fb4c82bf56d1a605.tar.gz |
Add tests.
Diffstat (limited to 'test')
-rw-r--r-- | test/output_test_helper.cc | 4 | ||||
-rw-r--r-- | test/reporter_output_test.cc | 24 |
2 files changed, 26 insertions, 2 deletions
diff --git a/test/output_test_helper.cc b/test/output_test_helper.cc index bbcc8a8..f14f8fc 100644 --- a/test/output_test_helper.cc +++ b/test/output_test_helper.cc @@ -38,7 +38,9 @@ SubMap& GetSubstitutions() { {" %s ", "[ ]+"}, {"%time", "[ ]*[0-9]{1,5} ns"}, {"%console_report", "[ ]*[0-9]{1,5} ns [ ]*[0-9]{1,5} ns [ ]*[0-9]+"}, - {"%csv_report", "[0-9]+," + dec_re + "," + dec_re + ",ns,,,,,"}}; + {"%console_us_report", "[ ]*[0-9] us [ ]*[0-9] us [ ]*[0-9]+"}, + {"%csv_report", "[0-9]+," + dec_re + "," + dec_re + ",ns,,,,,"}, + {"%csv_us_report", "[0-9]+," + dec_re + "," + dec_re + ",us,,,,,"}}; return map; } diff --git a/test/reporter_output_test.cc b/test/reporter_output_test.cc index 579135d..59a0a39 100644 --- a/test/reporter_output_test.cc +++ b/test/reporter_output_test.cc @@ -120,8 +120,30 @@ ADD_CASES(TC_CSVOut, {{".*BM_SummaryRepeat/repeats:3 ", MR_Not}, {"^\"BM_SummaryRepeat/repeats:3_mean\",%csv_report$"}, {"^\"BM_SummaryRepeat/repeats:3_stddev\",%csv_report$"}}); +void BM_RepeatTimeUnit(benchmark::State& state) { + while (state.KeepRunning()) { + } +} +BENCHMARK(BM_RepeatTimeUnit) + ->Repetitions(3) + ->ReportAggregatesOnly() + ->Unit(benchmark::kMicrosecond); +ADD_CASES(TC_ConsoleOut, + {{".*BM_RepeatTimeUnit/repeats:3 ", MR_Not}, + {"^BM_RepeatTimeUnit/repeats:3_mean %console_us_report$"}, + {"^BM_RepeatTimeUnit/repeats:3_stddev %console_us_report$"}}); +ADD_CASES(TC_JSONOut, {{".*BM_RepeatTimeUnit/repeats:3 ", MR_Not}, + {"\"name\": \"BM_RepeatTimeUnit/repeats:3_mean\",$"}, + {"\"time_unit\": \"us\",?$"}, + {"\"name\": \"BM_RepeatTimeUnit/repeats:3_stddev\",$"}, + {"\"time_unit\": \"us\",?$"}}); +ADD_CASES(TC_CSVOut, + {{".*BM_RepeatTimeUnit/repeats:3 ", MR_Not}, + {"^\"BM_RepeatTimeUnit/repeats:3_mean\",%csv_us_report$"}, + {"^\"BM_RepeatTimeUnit/repeats:3_stddev\",%csv_us_report$"}}); + // ========================================================================= // // --------------------------- TEST CASES END ------------------------------ // // ========================================================================= // -int main(int argc, char *argv[]) { RunOutputTests(argc, argv); } +int main(int argc, char* argv[]) { RunOutputTests(argc, argv); } |