-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspace_age_test.rb
57 lines (48 loc) · 1.23 KB
/
space_age_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
require 'minitest/autorun'
require_relative 'space_age'
class SpaceAgeTest < Minitest::Test
# assert_in_delta will pass if the difference
# between the values being compared is less
# than the allowed delta
DELTA = 0.01
def test_age_on_earth
# # skip
age = SpaceAge.new(1_000_000_000)
assert_in_delta 31.69, age.on_earth, DELTA
end
def test_age_on_mercury
# skip
age = SpaceAge.new(2_134_835_688)
assert_in_delta 280.88, age.on_mercury, DELTA
end
def test_age_on_venus
# skip
age = SpaceAge.new(189_839_836)
assert_in_delta 9.78, age.on_venus, DELTA
end
def test_age_on_mars
# skip
age = SpaceAge.new(2_329_871_239)
assert_in_delta 39.25, age.on_mars, DELTA
end
def test_age_on_jupiter
# skip
age = SpaceAge.new(901_876_382)
assert_in_delta 2.41, age.on_jupiter, DELTA
end
def test_age_on_saturn
# skip
age = SpaceAge.new(3_000_000_000)
assert_in_delta 3.23, age.on_saturn, DELTA
end
def test_age_on_uranus
# skip
age = SpaceAge.new(3_210_123_456)
assert_in_delta 1.21, age.on_uranus, DELTA
end
def test_age_on_neptune
# skip
age = SpaceAge.new(8_210_123_456)
assert_in_delta 1.58, age.on_neptune, DELTA
end
end