|
425 | 425 | assert_equal '', table[1].last |
426 | 426 | end |
427 | 427 |
|
428 | | - it 'always shows significance symbol but omits verbose columns without --pvalue' do |
| 428 | + it 'omits significance symbols and p-value columns without --pvalue' do |
429 | 429 | executable_names = ['ruby', 'ruby-yjit'] |
430 | 430 | bench_data = { |
431 | 431 | 'ruby' => { |
|
452 | 452 | table, _format = builder.build |
453 | 453 | refute_includes table[0], 'p-value' |
454 | 454 | refute_includes table[0], 'sig' |
455 | | - assert_match(/\(\*{1,3}\)$/, table[1].last) |
| 455 | + ratio_cell = table[1].last |
| 456 | + refute_match(/\*/, ratio_cell) |
| 457 | + assert_match(/\A\d+\.\d+\s*\z/, ratio_cell) |
| 458 | + end |
| 459 | + |
| 460 | + it 'shows significance symbols and p-value columns with --pvalue' do |
| 461 | + executable_names = ['ruby', 'ruby-yjit'] |
| 462 | + bench_data = { |
| 463 | + 'ruby' => { |
| 464 | + 'fib' => { |
| 465 | + 'warmup' => [0.1], |
| 466 | + 'bench' => [0.100, 0.101, 0.099], |
| 467 | + 'rss' => 1024 * 1024 * 10 |
| 468 | + } |
| 469 | + }, |
| 470 | + 'ruby-yjit' => { |
| 471 | + 'fib' => { |
| 472 | + 'warmup' => [0.05], |
| 473 | + 'bench' => [0.050, 0.051, 0.049], |
| 474 | + 'rss' => 1024 * 1024 * 12 |
| 475 | + } |
| 476 | + } |
| 477 | + } |
| 478 | + |
| 479 | + builder = ResultsTableBuilder.new( |
| 480 | + executable_names: executable_names, |
| 481 | + bench_data: bench_data, |
| 482 | + include_pvalue: true |
| 483 | + ) |
| 484 | + |
| 485 | + table, _format = builder.build |
| 486 | + assert_includes table[0], 'p-value' |
| 487 | + assert_includes table[0], 'sig' |
| 488 | + ratio_col_idx = table[0].index('ruby/ruby-yjit') |
| 489 | + assert_match(/\(\*{1,3}\)/, table[1][ratio_col_idx]) |
456 | 490 | end |
457 | 491 |
|
458 | 492 | it 'handles only headline benchmarks' do |
|
0 commit comments