mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Use integer division - Crystal 0.31.0 change
This commit is contained in:
parent
5d5cc0a41e
commit
adbfb7da7c
2 changed files with 4 additions and 4 deletions
|
@ -291,7 +291,7 @@ describe Spectator::DSL::SampleExampleGroupBuilder do
|
||||||
factory = Spectator::DSL::ExampleFactory.new(SpyExample)
|
factory = Spectator::DSL::ExampleFactory.new(SpyExample)
|
||||||
symbol = :test
|
symbol = :test
|
||||||
count = 3
|
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 }
|
create_proc = ->(s : SampleValueCollection) { s.create }
|
||||||
builder = Spectator::DSL::SampleExampleGroupBuilder.new("foobar", SampleValueCollection, create_proc, "value", symbol)
|
builder = Spectator::DSL::SampleExampleGroupBuilder.new("foobar", SampleValueCollection, create_proc, "value", symbol)
|
||||||
count.times { builder.add_child(factory) }
|
count.times { builder.add_child(factory) }
|
||||||
|
|
|
@ -25,15 +25,15 @@ module Spectator::Formatting
|
||||||
return "#{seconds.round(2)} seconds" if seconds < 60
|
return "#{seconds.round(2)} seconds" if seconds < 60
|
||||||
|
|
||||||
int_seconds = seconds.to_i
|
int_seconds = seconds.to_i
|
||||||
minutes = int_seconds / 60
|
minutes = int_seconds // 60
|
||||||
int_seconds %= 60
|
int_seconds %= 60
|
||||||
return sprintf("%i:%02i", minutes, int_seconds) if minutes < 60
|
return sprintf("%i:%02i", minutes, int_seconds) if minutes < 60
|
||||||
|
|
||||||
hours = minutes / 60
|
hours = minutes // 60
|
||||||
minutes %= 60
|
minutes %= 60
|
||||||
return sprintf("%i:%02i:%02i", hours, minutes, int_seconds) if hours < 24
|
return sprintf("%i:%02i:%02i", hours, minutes, int_seconds) if hours < 24
|
||||||
|
|
||||||
days = hours / 24
|
days = hours // 24
|
||||||
hours %= 24
|
hours %= 24
|
||||||
sprintf("%i days %i:%02i:%02i", days, hours, minutes, int_seconds)
|
sprintf("%i days %i:%02i:%02i", days, hours, minutes, int_seconds)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue