|
56 | 56 |
|
57 | 57 | table, format = builder.build |
58 | 58 |
|
59 | | - assert_equal ['bench', 'ruby (ms)', 'stddev (%)', 'ruby-yjit (ms)', 'stddev (%)', 'ruby-yjit 1st itr', 'ruby/ruby-yjit'], table[0] |
| 59 | + assert_equal ['bench', 'ruby (ms)', 'ruby-yjit (ms)', 'ruby-yjit 1st itr', 'ruby/ruby-yjit'], table[0] |
60 | 60 |
|
61 | | - assert_equal ['%s', '%.1f', '%.1f', '%.1f', '%.1f', '%.3f', '%s'], format |
| 61 | + assert_equal ['%s', '%s', '%s', '%.3f', '%s'], format |
62 | 62 |
|
63 | 63 | assert_equal 'fib', table[1][0] |
64 | | - assert_in_delta 100.0, table[1][1], 1.0 |
65 | | - assert_in_delta 50.0, table[1][3], 1.0 |
66 | | - assert_in_delta 2.0, table[1][5], 0.1 |
67 | | - assert_match(/^2\.0\d+/, table[1][6]) |
| 64 | + |
| 65 | + m = table[1][1].match(/\A(\d+\.\d) ± (\d+\.\d)%\z/) |
| 66 | + assert m |
| 67 | + assert_in_delta 100.0, m[1].to_f, 1.0 |
| 68 | + |
| 69 | + m = table[1][2].match(/\A(\d+\.\d) ± (\d+\.\d)%\z/) |
| 70 | + assert m |
| 71 | + assert_in_delta 50.0, m[1].to_f, 1.0 |
| 72 | + |
| 73 | + assert_in_delta 2.0, table[1][3], 0.1 |
| 74 | + |
| 75 | + m = table[1][4].match(/\A(\d+\.\d+)/) |
| 76 | + assert m |
| 77 | + assert_in_delta 2.0, m[1].to_f, 0.1 |
68 | 78 | end |
69 | 79 |
|
70 | 80 | it 'includes RSS columns when include_rss is true' do |
|
88 | 98 | table, format = builder.build |
89 | 99 |
|
90 | 100 | # No RSS ratio column with a single executable |
91 | | - assert_equal ['bench', 'ruby (ms)', 'stddev (%)', 'RSS (MiB)'], table[0] |
92 | | - assert_equal ['%s', '%.1f', '%.1f', '%.1f'], format |
93 | | - assert_in_delta 10.0, table[1][3], 0.1 |
| 101 | + assert_equal ['bench', 'ruby (ms)', 'RSS (MiB)'], table[0] |
| 102 | + assert_equal ['%s', '%s', '%.1f'], format |
| 103 | + assert_in_delta 10.0, table[1][2], 0.1 |
94 | 104 | end |
95 | 105 |
|
96 | 106 | it 'includes RSS ratio columns when include_rss is true with multiple executables' do |
|
122 | 132 |
|
123 | 133 | expected_header = [ |
124 | 134 | 'bench', |
125 | | - 'ruby (ms)', 'stddev (%)', 'RSS (MiB)', |
126 | | - 'ruby-yjit (ms)', 'stddev (%)', 'RSS (MiB)', |
| 135 | + 'ruby (ms)', 'RSS (MiB)', |
| 136 | + 'ruby-yjit (ms)', 'RSS (MiB)', |
127 | 137 | 'ruby-yjit 1st itr', |
128 | 138 | 'ruby/ruby-yjit', |
129 | 139 | 'RSS ruby/ruby-yjit' |
130 | 140 | ] |
131 | 141 | assert_equal expected_header, table[0] |
132 | 142 |
|
133 | | - expected_format = ['%s', '%.1f', '%.1f', '%.1f', '%.1f', '%.1f', '%.1f', '%.3f', '%s', '%.3f'] |
| 143 | + expected_format = ['%s', '%s', '%.1f', '%s', '%.1f', '%.3f', '%s', '%.3f'] |
134 | 144 | assert_equal expected_format, format |
135 | 145 |
|
136 | 146 | # RSS ratio: 10 MiB / 20 MiB = 0.5 |
|
209 | 219 |
|
210 | 220 | expected_header = [ |
211 | 221 | 'bench', |
212 | | - 'ruby (ms)', 'stddev (%)', |
213 | | - 'ruby-yjit (ms)', 'stddev (%)', |
214 | | - 'ruby-rjit (ms)', 'stddev (%)', |
| 222 | + 'ruby (ms)', |
| 223 | + 'ruby-yjit (ms)', |
| 224 | + 'ruby-rjit (ms)', |
215 | 225 | 'ruby-yjit 1st itr', |
216 | 226 | 'ruby-rjit 1st itr', |
217 | 227 | 'ruby/ruby-yjit', |
218 | 228 | 'ruby/ruby-rjit' |
219 | 229 | ] |
220 | 230 | assert_equal expected_header, table[0] |
221 | 231 |
|
222 | | - expected_format = ['%s', '%.1f', '%.1f', '%.1f', '%.1f', '%.1f', '%.1f', '%.3f', '%.3f', '%s', '%s'] |
| 232 | + expected_format = ['%s', '%s', '%s', '%s', '%.3f', '%.3f', '%s', '%s'] |
223 | 233 | assert_equal expected_format, format |
224 | 234 | end |
225 | 235 |
|
|
245 | 255 |
|
246 | 256 | assert_equal 2, table.length |
247 | 257 | assert_equal 'fib', table[1][0] |
248 | | - assert_in_delta 100.0, table[1][1], 5.0 |
| 258 | + m = table[1][1].match(/\A(\d+\.\d) ± (\d+\.\d)%\z/) |
| 259 | + assert m |
| 260 | + assert_in_delta 100.0, m[1].to_f, 5.0 |
249 | 261 | end |
250 | 262 |
|
251 | 263 | it 'sorts benchmarks with headlines first, then others, then micro' do |
|
0 commit comments