From a655858fa27fee7ae803bbc49b59042c2ffc94fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Fertyk?= Date: Mon, 3 Jun 2024 18:58:40 +0200 Subject: [PATCH] Improve error messages in space-age exercise [no important files changed] --- .../practice/space-age/space_age_test.gd | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/exercises/practice/space-age/space_age_test.gd b/exercises/practice/space-age/space_age_test.gd index 0f445b5..c2a0bc5 100644 --- a/exercises/practice/space-age/space_age_test.gd +++ b/exercises/practice/space-age/space_age_test.gd @@ -1,50 +1,46 @@ -func roughly_equal(n1, n2): - return abs(n1 - n2) <= 0.01 - - func test_age_on_Earth(solution_script): var age = solution_script.on_planet('Earth', 1000000000) - var expected = 31.69 - return [roughly_equal(age, expected), true] + var expected = 31.644 + return [snappedf(age, 0.01), expected] func test_age_on_Mercury(solution_script): var age = solution_script.on_planet('Mercury', 2134835688) - var expected = 280.88 - return [roughly_equal(age, expected), true] + var expected = 280.888 + return [snappedf(age, 0.01), expected] func test_age_on_Venus(solution_script): var age = solution_script.on_planet('Venus', 189839836) var expected = 9.78 - return [roughly_equal(age, expected), true] + return [snappedf(age, 0.01), expected] func test_age_on_Mars(solution_script): var age = solution_script.on_planet('Mars', 2129871239) var expected = 35.88 - return [roughly_equal(age, expected), true] + return [snappedf(age, 0.01), expected] func test_age_on_Jupiter(solution_script): var age = solution_script.on_planet('Jupiter', 901876382) var expected = 2.41 - return [roughly_equal(age, expected), true] + return [snappedf(age, 0.01), expected] func test_age_on_Saturn(solution_script): var age = solution_script.on_planet('Saturn', 2000000000) var expected = 2.15 - return [roughly_equal(age, expected), true] + return [snappedf(age, 0.01), expected] func test_age_on_Uranus(solution_script): var age = solution_script.on_planet('Uranus', 1210123456) var expected = 0.46 - return [roughly_equal(age, expected), true] + return [snappedf(age, 0.01), expected] func test_age_on_Neptune(solution_script): var age = solution_script.on_planet('Neptune', 1821023456) var expected = 0.35 - return [roughly_equal(age, expected), true] + return [snappedf(age, 0.01), expected]