Ad
  • Custom User Avatar

    duplicate issue above

  • Default User Avatar

    I used the SUM method wondering if the tests would be vague enough to fall of it. It did... this test could easily be added to catch my sneaky solution.

            var test = new int[][]
            {
              new int[] {5, 5, 5, 5, 5, 5, 5, 5, 5}, 
              new int[] {5, 5, 5, 5, 5, 5, 5, 5, 5},
              new int[] {5, 5, 5, 5, 5, 5, 5, 5, 5},
              new int[] {5, 5, 5, 5, 5, 5, 5, 5, 5},
              new int[] {5, 5, 5, 5, 5, 5, 5, 5, 5},
              new int[] {5, 5, 5, 5, 5, 5, 5, 5, 5},
              new int[] {5, 5, 5, 5, 5, 5, 5, 5, 5},
              new int[] {5, 5, 5, 5, 5, 5, 5, 5, 5},
              new int[] {5, 5, 5, 5, 5, 5, 5, 5, 5},
            };
    
  • Custom User Avatar

    I also have this message,but I solved it by removing my console.log statement.

  • Default User Avatar

    I think -1 existed long before Java. And it's bad but it's consistent with the behavior of indexOf in JS. And falsy values in a language with falsy 0 aren't much better in this case (used in PHP for this kind of functions; using == instead of === results in a bug)...

  • Custom User Avatar

    I did. Done, thanks.

  • Custom User Avatar

    This website is in English only at the moment (I don't see any buttons to change the language, at least), so it makes sense that a kata would be English focused if it isn't specifically targeting some other language.

    Also, English's silly ordinal number system makes the kata more challenging. Returning century + "世紀" is considerably easier than what you currently have to do.

  • Custom User Avatar

    No, it is on purpose: did you see what you should do if the input is not a number?

  • Custom User Avatar

    Please attach your solution and click on "Mark as having spoiler content", I'll help you.

  • Custom User Avatar

    Unit test messages should state what input was given and what should be the answer

    Yes, it's about assertEquals tests. When we talk about expectError it should contain the note about what error/exception is expected. In your case it's non-string argument type.

    so it is a string, the message is wrong

    Message isn't wrong.

    Here is some info about typeof operator.

    Note that operand should be within the quotes.

  • Custom User Avatar

    But I rewrote this message.

    Thanks for feedback! :relieved:

  • Custom User Avatar

    It means that input argument (HTML color) must be a string.

    If it isn't a string then an error should be thrown.

  • Custom User Avatar

    In the previous comments, we talked about medal range in test cases. To seek a robust solution, some unrealistic test cases are necessary.