The tests are fine. Hobovsky explained the confusion you seem to be having above.
It seems that your code is simply buggy, in that is trying to unwrap the Result from parse(), which is invalid if the Result is an Error. This is why using unwrap is typically bad habit. Check your numbers before parsing them.
I checked the tests which the creator has made, and it seems that he / she / they are testing 2 different functions
Not exactly. The kata wants you to perform the so-called "silly addition" every time. It;s just some inputs sometimes result in behavior identical to "normal addition". For example, when you do the "silly addition" with inputs 12 + 44, you will still get 56.
I may be wrong, but I don't think nested loops will work here.
The tests are fine. Hobovsky explained the confusion you seem to be having above.
It seems that your code is simply buggy, in that is trying to unwrap the
Result
fromparse()
, which is invalid if the Result is an Error. This is why usingunwrap
is typically bad habit. Check your numbers before parsing them.Not exactly. The kata wants you to perform the so-called "silly addition" every time. It;s just some inputs sometimes result in behavior identical to "normal addition". For example, when you do the "silly addition" with inputs
12 + 44
, you will still get 56.See if this paragraph is of any help: https://docs.codewars.com/training/troubleshooting#print-input, and maybe raise a suggestion to make assertion messages clearer.
What's the first number in the array you build?
What's the value of d in the tests you're failing? You can use
console.log
to print the input values.Your code is failing one of the sample tests too, check that, and how you build you array, that'll help.