Ad
  • Custom User Avatar

    For Java, in your testcases, you may want to use assertArrayEquals instead of assertEquals

  • Custom User Avatar

    got retired

  • Custom User Avatar

    Could do with more random tests

  • Custom User Avatar

    It might help, but notice that your soltion still crashes in one of ~five runs. Apparently, mutating the array only emphasized some other bug sitting somewhere there.

  • Custom User Avatar

    Thank you, Making a copy of arr did the trick.

  • Custom User Avatar

    Additionally, in some cases your call to is_pair(*start, *(start + 1)) seems to read past the end of the arr.

  • Custom User Avatar

    The cause of your problem is the fact that your code mutates arr, and the changes you make to it destroy the data which is later used by tests to verify your result. Unfortunately, for some reason beyond my understanding, the solution function accepts the input as a non-const reference, and any mutation turns out to be destructive. You can resolve your issue by either making a copy of arr in your solution, or changing the function signature to accept arr by value or by const reference.

    I will fix the setup of the challenge and change the function signature some time soon, but I cannot give any ETA for that.

  • Custom User Avatar

    But isn't it more logical to cancel out everything even if it's not directly opposite? If 'NORTH, WEST, SOUTH, EAST' brings you to the same spot, why does tha kata request to not remove anything (because it's not directly opposite)? I'm just curious, as if I was to build a similar function in the future, I would do it my way

  • Custom User Avatar

    I didn't notice the feature of preloaded snippet. Thanks for pointing.

    1. Moved the Point class to Preloaded snippet
    2. Updated description
  • Custom User Avatar

    The class Point has to be put in the preloaded snippet, or tests must not rely on this class. I can change distanceTo to return always 0 and pass all random test by simply returning points.

    getRandomNumber can be just rnd.nextInt(lo, hi), or rnd.ints(lo, hi, count). There might be a part of "javascript" in "java" but let;s keep it only in the name, and not in this unnecessary "idiom" of getting a random integer.

  • Custom User Avatar

    Resolved. Thank you for the pointer!

  • Custom User Avatar
  • Custom User Avatar

    Random Tests test the user's solution against a repeat of itself.

  • Custom User Avatar

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

  • Custom User Avatar

    What is going on?

    Time: 2708ms Passed: 0Failed: 4Exit Code: 1
    Test Results:
    Fixed_Tests
    Basic_Tests
    Expected: equal to [8.6667, 6.6667]
    Actual: [8.6667, 6.6667]
    Random_Tests
    Moderate_Values
    Expected: equal to [33, 37.3333]
    Actual: [33, 37.3333]
    High_Values
    Expected: equal to [642.333, 895.667]
    Actual: [642.333, 895.667]
    Huge_Values
    Expected: equal to [4697.33, 6422]
    Actual: [4697.33, 6422]

  • Loading more items...