Ad
  • Custom User Avatar

    the testing code should be moved from preloaded to tests in C++

  • Custom User Avatar

    in Java, assertArrayEquals should be used instead of stringifying the arrays, which produces confusing assertion messages

  • Custom User Avatar

    your solution is not robust because it uses a space separator that it then splits on to produce the pairs. that's assuming that the input string never contains spaces, which is not true in the random tests. not a kata issue.

  • Custom User Avatar

    the error comes from your code, you removed the const qualifier from the input (std::string &s instead of const std::string &s). As a result, the tests cannot find your function. this is a linker error, unrelated to the warning for comparison of signed and unsigned integers.

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    Why would you assume that? If test cases were wrong, the kata wouldn't be approved. The problem comes from the fact that:

    1: you're mutating the input string (rarely a good idea)

    2: the tests do not guard against this. First, your function is run with the mentioned string, which you mutate, and then the reference solution is run with what's left of the string, leading to unexpected results.

    #2 is actually an issue, and should be fixed. I already see some issues raised below about it, and I'm amazed that this issue hasn't been fixed for 4 years or something?!

    Still, I have to close it as duplicate (for now). Try to avoid mutating input where possible.

  • Custom User Avatar
    solution("BlTWkPaAOEjPacvPtykgCOTzDXNevA")
    expected: ["vA"]
         got: ["Bl", "TW", "kP", "aA", "OE", "jP", "ac", "vP", "ty", "kg", "CO", "Tz", "DX", "Ne", "vA"]
    

    i'm assuming the test cases are incorrect? (ruby)