Ad
  • Custom User Avatar

    Kata description is misleading. It says not a finite number. Your test use NaN and in my understanding NaN is a number but not a finite number (isFinite(NaN) returns false). So In my opinion returning false when encountering NaN is correct but your test says it is wrong and I have to return NaN 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.

  • Custom User Avatar

    Nope, it's not correct. Try this solution:

    function whatsTheDegree(p) {
          return null;
    }
    

    The test says:

    Expected: null, instead got: 0
    

    It should say:

    Expected: 0, instead got: null
    
  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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:

    test8(AreSameTest)
    195 -> 38025 ? True
    191 -> 36481 ? True
    161 -> 25921 ? True
    144 -> 20736 ? True
    19 -> 361 ? True
    1 -> 196 ? False
    expected: but was:
    

    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...

  • Custom User Avatar

    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.

  • Custom User Avatar

    Tests are fixed now

  • Custom User Avatar

    Maybe the old tests were still cached somewhere. It works now.

  • Custom User Avatar

    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-reference

  • Custom User Avatar

    Yes, now it works.

  • Custom User Avatar

    Test cases are broken. Simply returning true passes all tests. I guess you want to use Test.assertEquals instead of Test.expect.

  • Custom User Avatar

    Simply do this:

    function checkRoot(string){
        return "This is not the solution you are looking for";
    }
    

    Then hit the Run Tests button. All tests succeed. Test.expect only checks if the returned value is truthy.

  • Custom User Avatar

    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?

  • Custom User Avatar

    The test cases are completely broken, they always pass, no matter what I return.

  • Loading more items...