mirror of https://github.com/google/benchmark.git
[tools] Don't forget to print UTest when printing aggregates only
This probably regressed in #1042.
This commit is contained in:
parent
c05843a9f6
commit
362c2ab9c6
|
@ -301,11 +301,8 @@ def print_difference_report(
|
|||
fmt_str = "{}{:<{}s}{endc}{}{:+16.4f}{endc}{}{:+16.4f}{endc}{:14.0f}{:14.0f}{endc}{:14.0f}{:14.0f}"
|
||||
for benchmark in json_diff_report:
|
||||
# *If* we were asked to only include aggregates,
|
||||
# and if it is non-aggregate, then skip it.
|
||||
if include_aggregates_only and 'run_type' in benchmark:
|
||||
if benchmark['run_type'] != 'aggregate':
|
||||
continue
|
||||
|
||||
# and if it is non-aggregate, then don't print it.
|
||||
if not include_aggregates_only or not 'run_type' in benchmark or benchmark['run_type'] != 'aggregate':
|
||||
for measurement in benchmark['measurements']:
|
||||
output_strs += [color_format(use_color,
|
||||
fmt_str,
|
||||
|
@ -643,6 +640,52 @@ class TestReportDifferenceWithUTest(unittest.TestCase):
|
|||
parts = [x for x in output_lines[i].split(' ') if x]
|
||||
self.assertEqual(expect_lines[i], parts)
|
||||
|
||||
def test_json_diff_report_pretty_printing_aggregates_only(self):
|
||||
expect_lines = [
|
||||
['BM_Two', '+0.1111', '-0.0111', '9', '10', '90', '89'],
|
||||
['BM_Two', '-0.1250', '-0.1628', '8', '7', '86', '72'],
|
||||
['BM_Two_pvalue',
|
||||
'0.6985',
|
||||
'0.6985',
|
||||
'U',
|
||||
'Test,',
|
||||
'Repetitions:',
|
||||
'2',
|
||||
'vs',
|
||||
'2.',
|
||||
'WARNING:',
|
||||
'Results',
|
||||
'unreliable!',
|
||||
'9+',
|
||||
'repetitions',
|
||||
'recommended.'],
|
||||
['short_pvalue',
|
||||
'0.7671',
|
||||
'0.1489',
|
||||
'U',
|
||||
'Test,',
|
||||
'Repetitions:',
|
||||
'2',
|
||||
'vs',
|
||||
'3.',
|
||||
'WARNING:',
|
||||
'Results',
|
||||
'unreliable!',
|
||||
'9+',
|
||||
'repetitions',
|
||||
'recommended.'],
|
||||
['medium', '-0.3750', '-0.3375', '8', '5', '80', '53'],
|
||||
]
|
||||
output_lines_with_header = print_difference_report(
|
||||
self.json_diff_report, include_aggregates_only=True, utest=True, utest_alpha=0.05, use_color=False)
|
||||
output_lines = output_lines_with_header[2:]
|
||||
print("\n")
|
||||
print("\n".join(output_lines_with_header))
|
||||
self.assertEqual(len(output_lines), len(expect_lines))
|
||||
for i in range(0, len(output_lines)):
|
||||
parts = [x for x in output_lines[i].split(' ') if x]
|
||||
self.assertEqual(expect_lines[i], parts)
|
||||
|
||||
def test_json_diff_report(self):
|
||||
expected_output = [
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue