I had to attempt some 10 times due to differences around the 14th decimal (see below) which made me fail the random test. That was quite annoying especially because used a solution very close to the sensei's. i assume that this is due to floating point calculation errors of the server and not an intended part of the task. i would propose to use delta base test cases ( like assertAlmostEqual(a1,a2,12) )
Apart from that, nice kata.
#129.53766699321704 should equal 129.53766699321702
#93.43629811284134 should equal 93.43629811284133
#46.73502474311967 should equal 46.73502474311968
Fixed it. I used math in my correct solution, copied it over to the Test cases, but forgot to import math in the tests to make my code work without having math in the user solution.
This is just an idea, and may go against what you're going for with this beginner kata, but it could be a good idea to add some larger numbers in the tests to make performance a slight issue.
Haskell translation
The description has been updated to be more language-agnostic and to fix minor formatting/grammar errors.
Fixed by last fork.
Fixed by last fork.
merged
python: Floating point comparison should be used. i.e,
assert_approx_equals
python new test framework is required. updated in this fork
Python: Random tests are vulnerable to input modification
Java traduction
That's a suggestion, not an issue.
The example tests are still using
assert_equals
.I think I've fixed it now, thanks for the note
I had to attempt some 10 times due to differences around the 14th decimal (see below) which made me fail the random test. That was quite annoying especially because used a solution very close to the sensei's. i assume that this is due to floating point calculation errors of the server and not an intended part of the task. i would propose to use delta base test cases ( like assertAlmostEqual(a1,a2,12) )
Apart from that, nice kata.
Fixed it. I used math in my correct solution, copied it over to the Test cases, but forgot to import math in the tests to make my code work without having math in the user solution.
Thanks for the catch!
I get On attempt, I get:
NameError: name 'math' is not defined
(I am not using math, I assume you are in your tests?)
This is just an idea, and may go against what you're going for with this beginner kata, but it could be a good idea to add some larger numbers in the tests to make performance a slight issue.