lib/benchmark_driver/output/markdown.rb in benchmark_driver-0.14.3 vs lib/benchmark_driver/output/markdown.rb in benchmark_driver-0.14.4
- old
+ new
@@ -80,10 +80,14 @@
ensure
$stdout.sync = sync
end
def humanize(value)
- if value < 0
+ if BenchmarkDriver::Result::ERROR.equal?(value)
+ return " %#{NAME_LENGTH}s" % 'ERROR'
+ elsif value == 0.0
+ return " %#{NAME_LENGTH}.3f" % 0.0
+ elsif value < 0
raise ArgumentError.new("Negative value: #{value.inspect}")
end
scale = (Math.log10(value) / 3).to_i
prefix = "%6.3f" % (value.to_f / (1000 ** scale))