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.
Kata description is misleading. It says
not a finite number
. Your test useNaN
and in my understandingNaN
is a number but not a finite number (isFinite(NaN)
returnsfalse
). So In my opinion returningfalse
when encounteringNaN
is correct but your test says it is wrong and I have to returnNaN
instead. I don't see the sense. So when this is a requirement then you should mention it in the description. Or fix the tests if this was not your intention.Nope, it's not correct. Try this solution:
The test says:
It should say:
The arguments to
assertEquals
are in the wrong order. The actual value must be the first one and the expected value must be the second one. You did it in JUnit order which is not the same as used in this JS test framework here.This is the new 'spread' operator in ECMAScript 6. See https://github.com/lukehoban/es6features#default--rest--spread
It spreads an array (
this
in this case) into single function arguments.Ah, the Java tests are simply harder than the JavaScript tests. Found the problem but not spoilering them here. ;-) But still the test output is confusing, you really should change it so it shows the actual and expected result.
Very confusing in Java... I had no problem solving it in JavaScript but I can't pass the last test in Java and I have no idea why. This is my debug output:
So I return false because 1 * 1 can't be 196 and there is no "1" in the other array. But the test fails and the broken test output doesn't help much...
I added a test case for a single value and changed the description so the Code Warrior knows for sure that there will be at least one number.
Tests are fixed now
Maybe the old tests were still cached somewhere. It works now.
You fixed the example test cases, but not the final test cases. So it is still possible to simply return
true
to solve the Kata. The test framework documentation can be found here: http://www.codewars.com/docs/js-slash-coffeescript-test-referenceYes, now it works.
Test cases are broken. Simply returning
true
passes all tests. I guess you want to useTest.assertEquals
instead ofTest.expect
.Simply do this:
Then hit the
Run Tests
button. All tests succeed.Test.expect
only checks if the returned value is truthy.Confusing test cases. The real ones expect an exception while the provided ones only works when I return the error message instead of throwing it. Or was that a part of the Kata? Repairing the provided unit tests?
The test cases are completely broken, they always pass, no matter what I return.
Loading more items...