Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Seems like that's the bug for Ruby testing; raised an issue about that
This comment is hidden because it contains spoiler information about the solution
See the issue above. When you mutated the input, you changed the expected value, so even if your result was ok, the tests compared it against a different value.
Ruby: tests are susceptible to mutation of input (originally reported with this post).
Thank you! Yes that was the problem and solved by duplicating the original array.
But actually I don't realy get why that is a problem?
If it only fails random tests, then one possible reason is your code mutating the input array, check that.
This comment is hidden because it contains spoiler information about the solution
For me its a realy clever solution but not a best practice. Readability could be better, style: empty line after guard clause?, and no need for attr_reader...
But don't get me wrong it's still a absolute nice and clever solution in my opinion...
This comment is hidden because it contains spoiler information about the solution
Added ;-)
Thank you! Learned somthing new :)
It would be maybe helpful to tell in the kata description how many tests to pass.
You're using
.digits
which is actually very slow for this. There is a much faster way ;-)I dont get it, it seems that I pass all tests and than it times out...
Example tests, Random tests with Small numbers (50 of 50 Assertions) and Large numbers (18 of 18 Assertions)...
Are theire more test, do I realy have to improve the given code?
I pass all sample test and get on all random test the following error:
./spec/solution_spec.rb:14:in `block in expected_twin_prime': uninitialized constant Prime (NameError)
Is their somthing wrong with the tests? I checked the output of my code for the provided test numbers and it seems to be correct. Or do I miss smth?
okay, I simply had to use the method too (I checked my regex in it) and than it works. The instruction reads like it would be possible to do only the regex but that didn't work...
Loading more items...