hey, thanks for the review, i modified the literals so that they are Integers; the random tests should now expect true ~50% of the time.
this kata makes no sense for floating point numbers and the tedious input validation mentioned in the description is against the authoring guidelines, and will have to be removed from all languages at some point (plus the kata has already been translated to statically typed languages where this kind of input validation is impossible)
The n generated in random tests are always a float, so returning false will pass all random tests. (This is because 1e5 & 1e9 are treated as floats in Ruby)
You can replace 1e5 with 10**5 to generate true cases sometimes. (False cases can be a mix of integers & float value, or purely integers, depends on you)
Not a kata suggestion
Ruby:
(Actual & expected were flipped in the assertion, so your code actually failed to consider repeating elements)
Added in Ruby
Done in this fork
Runs in Node v10.x ...for some reason
This comment is hidden because it contains spoiler information about the solution
Fixed in this fork
Approved the fork above
Approved
hey, thanks for the review, i modified the literals so that they are
Integer
s; the random tests should now expecttrue
~50% of the time.this kata makes no sense for floating point numbers and the tedious input validation mentioned in the description is against the authoring guidelines, and will have to be removed from all languages at some point (plus the kata has already been translated to statically typed languages where this kind of input validation is impossible)
Enabled Ruby 3.0 + RSpec [1]
Generate true cases more often
Added an edge cases [2]
Flipped actual & expected in the assertion [3]
The
n
generated in random tests are always a float, so returningfalse
will pass all random tests. (This is because1e5
&1e9
are treated as floats in Ruby)You can replace
1e5
with10**5
to generate true cases sometimes. (False cases can be a mix of integers & float value, or purely integers, depends on you)Enabled Ruby 3.0 + RSpec
Refsol now recurses properly instead of calling user solution
Enabled Ruby 3.0 + RSpec
Loading more items...