6 kyu

Shorter Path

373 of 606Nancy27
Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • trashy_incel Avatar

    Java fork

    • fixing this issue (empty array for an empty path rather than an array containing an empty string)
    • JUnit5
    • better assertion messages
    • overhauled the tests suite
  • ElYuma Avatar

    it returns this ['W', 'W', 'W', 'W', 'W', 'W', 'W', 'N'] should equal ['N', 'W', 'W', 'W', 'W', 'W', 'W', 'W'] randomly like an error, even when both solutions are correct. Now I have to figure out how to make my code adapt to the order of those random text 😐.

  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • saudiGuy Avatar

    Python: The example tests and test suite aren't using the test framework, missing the imports (user's solution + framework).

  • ejini战神 Avatar

    C#: method name should be PascalCase (Please refer to implementation of backward compatibility here )

  • Quark Fox Avatar

    Awesome kata actually, was amazed by the solution page, Nice simple beauiful solutions, mine was rather complicated!! :-( Thanks Nancy27

  • Skoq95 Avatar

    "If you get back to beginning, return an empty array." - there is wrong test written in Sample Tests. It assumes that when you go to the beggining, you return not an empty array but an empty string so that the array length is = 1... Please correct that.

  • aayore Avatar

    Python test results seem reversed. ['S'] should equal [] should equal [] should equal ['S']...

  • PoPZeRo Avatar

    This comment has been hidden.

  • Blind4Basics Avatar

    Closed the previous issue while I shouldn"t have, so here it goes again...:

    Java tests are not consistent with the python version:

    For python:
    goal=["N","W","S","E"]
    test.assert_equals(directions(goal), [])
    
    For java:
    String[] goal3 = {"N","W","S","E"};
    assertArrayEquals(new String[] {""}, ShortestPath.directions(goal3));
    

    Python does the right move, here. Should be new String[0] for java.

    And same problem for the inverted test: the input with new String[] {""} is not an empty array so is invalid. Python sends a real empty list [] instead.

    And DM comments:

    Agree. Irrespective of python, it is just not sensible

    • it means all solutions have to code for a special case of 0.
    • if means the size of the array does not always mean the number of steps
  • Blind4Basics Avatar

    Hi,

    Java tests are not consistent with the python version:

    For python:
    goal=["N","W","S","E"]
    test.assert_equals(directions(goal), [])
    
    For java:
    String[] goal3 = {"N","W","S","E"};
    assertArrayEquals(new String[] {""}, ShortestPath.directions(goal3));
    

    Python does the right move, here. Should be new String[0] for java.

    And same problem for the inverted test: the input with new String[] {""} is not an empty array so is invalid. Python sends a real empty list [] instead.

  • YevheniiK Avatar

    Random tests still broken.(java)

  • user4355430 Avatar

    I guess there is some kind of mistake with random tests (java). for example: input array: E E W E N N S N N N my output array: N N N N E E this is what tests say: array lengths differed, expected.length=3 actual.length=6

    input array: E S S E E W N S N W my output array: S E this is what tests say: array lengths differed, expected.length=4 actual.length=2

    input array:N N E E S W S E S E my output array:S E E E this is what tests say: array lengths differed, expected.length=6 actual.length=4

    and besides as far as i understand if you stay on the same place the function should return an empty array (length=0) but the tests demand it to return the array with one empty string (length=1).

  • lastmind4 Avatar

    This comment has been hidden.

  • bdarksider Avatar

    nice kata!

  • LawlietRyuzaki69 Avatar

    Why in test ['S', 'S', 'N', 'E', 'W', 'N', 'W', 'S', 'E'] ['S'] should equal ['N', 'S', 'S']?

  • MarkPearlCoZa Avatar

    It looks like your random tests in the C# instance are broken.

    For instance with an input of WWESWS, I expected SSWW but the test says it is expecting S

  • MarkPearlCoZa Avatar

    In the C# instance, your test cases should be CollectionAsserts, not Asserts.

  • yarlaxle Avatar

    Random tests doesnt work, atleast in my opinion

  • acraileanu Avatar
  • Evgen123 Avatar

    expect, in tests there are some mistakes [W, N, W, N, W, E, N, N, N, N, N, S, N, S, W, S, N, N, E, W, W, W, E, N, N, E, E, N, N, S, N, W, N, W, N, S, E, N, W, E, E, W, N, S, N, W, S, E, E, W, E, S, E, N, E, N, N, E, S, S, E, E, S, S, N, S, N, E, E, W, N, S, E, W, W, N] {S=14, E=19, W=16, N=27} NNNNNNNNNNNNNEEE len=16 [N, N, N, N, N, N, N, N, N, N, N, N, N, E, E, E] array lengths differed, expected.length=16 actual.length=17

  • xluthi Avatar

    Good kata. The great thing is that it can be solved with many different code, for simplest to smartest. Thanks.

  • raulbc777 Avatar

    Good kata. Thanks.