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.
I'm going to work on the random tests today. Thanks @Blind4Basics for the links provided. Cheers.
-> here:
Testing is wildly inadequate. Kata needs more fixed testing, and needs random testing ( every kata needs random testing ).
No random testing may also mean an automatic downvote from certain people. Including me. I may come back to change that vote if and when you add random tests, but you should really have random testing from the first time you hit
Publish
.Oh. You're new. Of course you are new. Read available documentation on publishing your first kata. Having random tests is in there.
Thanks! Will refactor this asap.
Hi,
Nice enough. But for now, the sample tests are giving away most of the logic. Same about the description when you explain the different numbers of arguments. I'd prune the description from the exemple, and moved the needed stuff from the sample tests into the preloaded part.
Note: you'll have to redefine all that stuff into the test cases part, or be perfectly sure that nothing can be redefined by the user if you don't.
Oh, and you need random tests.
cheers
You are right, thanks for your time
That doesn't create a copy, that's another reference to the same array. You can easily check that printing seq before your manipulations and just before the return line.
This comment is hidden because it contains spoiler information about the solution
Is that ok? I can't find info on
copy
method, and the assignment seems wrong.Reading this could help you.
Sure, in the first line I put:
seq.copy = seq
. After that I only use seq.copy on the rest of the code. There is something wrong in this?A copy is passed to the control function after the original array is passed to the user's function. It should be the other way around, the copy should be passed to the user's function.
Can we see how you made your copy?
I made a copy of the input and only used the copy in the logic. Still the same result
Don't modify the input.
In ruby, the random test expects 'nil' as results when the input has clearly one number which is odd times repeated.
Testing for [1, 14, 8, 8, 10, 1, 1, 6, 1, 14, 10, 4, 8, 1, 4, 16, 1, 16, 8]
It should work for random inputs too - Expected: nil, instead got: 6