Ad
  • Custom User Avatar

    Whats good about this its easy to read, and if your password requirements were to change eg you need include a check for special characters, you can just add it to it without having to change the existing requirements or changing everything all at once.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    i still didn't understand, how i must to decode it.

  • Default User Avatar

    Is there even some kind of algorithm that created the letter mappings? I've tried to figure it out at first (~15 mins), then i gave up and brute forced my way through it (press attempt to get the letters).

    If there is a legitimate algorithm that maps the letters, the kata could easily be 2-4 Kyu. If there isn't, then most of the difficulty comes from getting all the letters, not the actual problem, which makes it 7 Kyu. That's a pretty big difference.

    If there is an algorithm, could you post it somewhere (here, github, ...) so i can look at it, i'm just really curious how it works.

  • Custom User Avatar

    Thanks Voile, I split them out and added for loops for the random tests so that its not duplicating the random tests.

  • Custom User Avatar

    Please structure your tests properly:

    • Fixed tests and random tests should not go into the same block, as it'll be very confusing. You can further split the tests to organize them. (describe blocks can nest. Only the last block requires to be a it block)
    • There are only a handful of random tests being run, and each run is duplicate code. Why aren't the random tests run inside a for loop?
  • Custom User Avatar

    Ahh gotcha that makes perfect sense! thank you this was my first authored Kata so I will keep that in mind

  • Custom User Avatar

    So it looks like this kata was retired, but for future reference, the issue with the implementation of the random tests was this:

    String randomString1 = generateRandomDecodableString();
    String decoded1 = Kata.decode(randomString1);
    assertEquals(Kata.decode(randomString1),decoded1);
    

    This test ends up comparing the solution's answer to itself, which will return true regardless of the correctness of the solution. Instead, you'll want to have your own code within the submission tests which produces the correct answer and compare the solution's result to that. Something like:

    String randomString1 = generateRandomDecodableString();
    String decoded1 = referenceDecode(randomString1);
    assertEquals(decoded1, Kata.decode(randomString1));
    

    where referenceDecode is a known correct solution.

  • Custom User Avatar

    Thanks scarecrw! I added more random tests for both positive and negitive test cases, and validated that they are not returning false positives. Same with the other languages as well.

  • Custom User Avatar
    • Insufficient random tests: only one random valid and invalid word tested
    • Random tests improperly implemented: valid case will always pass

    (In Java, didn't check other languages)

  • Custom User Avatar

    Thank you Voile, updated to have empty string return empty string, made the initial code be decode instead of decoded, and added notes about undefined and null in description.

  • Custom User Avatar

    Thank you Voile for this great feedback,I updated the example tests to be a subset of the main tests so they should all match. I also added both random positive and negative tests

  • Custom User Avatar

    Thanks Voile, I will get this fixed!

  • Custom User Avatar

    Sample tests and actual tests contain different test cases. Actual tests should at least be a superset of all sample tests.

    There are no random tests.

  • Custom User Avatar

    Why empty string should return unable to decode? Empty string encodes to empty string, so it is a valid input.


    JS version: function name in initial code is decoded, but it should be decode.


    If string contains spaces, special characters or numbers it cannot be decoded and will result in a message

    undefined is passed into the function too. This is not mentioned.

  • Loading more items...