Use integer division - Crystal 0.31.0 change

This commit is contained in:
Michael Miller 2019-09-23 19:38:15 -06:00
parent 5d5cc0a41e
commit adbfb7da7c
2 changed files with 4 additions and 4 deletions

View file

@ -291,7 +291,7 @@ describe Spectator::DSL::SampleExampleGroupBuilder do
factory = Spectator::DSL::ExampleFactory.new(SpyExample)
symbol = :test
count = 3
expected = Array.new(SAMPLE_VALUES_COLLECTION.size * count) { |i| SAMPLE_VALUES_COLLECTION[i / count] }
expected = Array.new(SAMPLE_VALUES_COLLECTION.size * count) { |i| SAMPLE_VALUES_COLLECTION[i // count] }
create_proc = ->(s : SampleValueCollection) { s.create }
builder = Spectator::DSL::SampleExampleGroupBuilder.new("foobar", SampleValueCollection, create_proc, "value", symbol)
count.times { builder.add_child(factory) }

View file

@ -25,15 +25,15 @@ module Spectator::Formatting
return "#{seconds.round(2)} seconds" if seconds < 60
int_seconds = seconds.to_i
minutes = int_seconds / 60
minutes = int_seconds // 60
int_seconds %= 60
return sprintf("%i:%02i", minutes, int_seconds) if minutes < 60
hours = minutes / 60
hours = minutes // 60
minutes %= 60
return sprintf("%i:%02i:%02i", hours, minutes, int_seconds) if hours < 24
days = hours / 24
days = hours // 24
hours %= 24
sprintf("%i days %i:%02i:%02i", days, hours, minutes, int_seconds)
end