Ad
  • Custom User Avatar

    Hi, I've been trying to complete this kata, but I'm stuck. I think I have some issue with rounding maybe... because it looks like most of the tests are off just sometimes and by just a few hundredths

    For example:
    Unhandled rejection TestError: Random - Expected:
    [['0.55', '2.14'], ['0.45', '1.61'], ['0.95', '4.73'], ['1.37', '4.15'], ['0.51', '4.22'], ['0.43', '5.35']], instead got:
    [['0.54', '5.28'], ['0.44', '4.75'], ['0.93', '4.73'], ['1.35', '4.15'], ['0.49', '4.22'], ['0.41', '5.35']]

  • Custom User Avatar

    o_O

  • Custom User Avatar

    Damn yeah. I shortened it to to isolate the problem + to see if it'd resolve other issues. Thanks again for help

  • Custom User Avatar

    Nice.
    But most of random cases expect only 1-length-array.
    You better fill it with more data to actually test if The rifle will shoot closer enemies first. is correctly implemented.

  • Custom User Avatar
  • Custom User Avatar

    FIXED IT!!!! BOOOOM!

  • Custom User Avatar

    Maybe there are some edge cases which cause your solution a infinite loop.
    You can log random data to see what happended.

  • Custom User Avatar

    Actually it's for both validate and publish. I think it's taking too long to process so it's timing me out. Kind of weird seeing as it does the basic tests in a fraction of a second. Surely it should only take double the time for random tests?

  • Custom User Avatar

    Ahh phew! Yeah it's the former but it only happens when I try to do more than 3 random tests. I'll keep trying!

  • Custom User Avatar

    You mean you get timeout whenever you PUBLISH or VALIDATE SOLUTION?
    The former one is usual in CW, you just need to try again and again (sometimes even if you got a timeout feedback, the code is actually updated).
    The later one means there are problem with your solution.

  • Custom User Avatar

    Hi,

    Thanks for your help. I do have a problem with adding additional iterations on the random tests. It seems to cause a network error? Does this mean I should try and simplify my code? I've made the other amendments.

  • Custom User Avatar
    • Random tests are too few, usually we do 100 times.
    • Please use Test.assertDeepEquals instead of Test.assertSimilar
    • Inputs are vulnerable, please set up random test asserting like this
    const expected = completeSolution(testInput)
    Test.assertDeepEquals(fire(testInput), expected, ...)
    
  • Custom User Avatar

    Sample tests and description expect wrong result

    ... returns [["1.16","1.11"] ...
    
  • Custom User Avatar

    Hahah yep, silly mistake. Cheers for the pointer

  • Custom User Avatar

    No, the tests are fine, it seems you're the one that's mutating the input, check the note.

    Note: you shouldn't mutate the input

  • Loading more items...