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 have added more.
Description and example updated.
Tests fixed.
Somehow I can't use
#context
inside describe block. Codewars doesn't have it?undefined method `context' for main:Object (NoMethodError)
By the way, how do you want to test it with random inputs? For instance, we will have random elements at array or random number - in which way you will know that answer will be correct, if you don't know the actual inputs? Looks like the only way is to establish formula inside test, but it's the same what method for correct answer do, so it doesn't seem like a truthful test.
Do u mean cases when we have, for instance, 10 and 20 at array for number 15?
Which situations u want to cover as well?
I have added sample test as "#TODO:", since I found such approach at the most of other katas.
What do you mean under "random" tests? Tests with randomly generated numbers?
Yes, but I don't like expression with
else
insidecase
. It's not so much informative.Should I sort array "gifts" alphabetically?