Ad
  • Default User Avatar

    The same here.

  • Default User Avatar

    Hi, I've nearly done it, but on test 11 i get this error "Expected: -1, instead got: 1..9", any ideas why? Cheers

  • Default User Avatar

    Hello !
    I've tried this in Java, and all work has expected when I run my solution on Eclipse and with the "Run Tests" button of this site. But When I click "Submit" tests doesn't work. I haven't modified the tests. What's happen please ?

  • Custom User Avatar

    Yes now I understand but how happens that everybody else pass the tests? Anyway I think I can't change anymore the tests: more than 500 people passed the kata... and I don't see in Codewars Java reference tests anything aboout "deepEquals". Codewars refers to:
    http://www.vogella.com/tutorials/JUnit/article.html#usingjunit_asserts.

  • Default User Avatar

    When I pass tests on Eclipse with JUnit, this test doesn't works:

    assertEquals(
    ""NORTH", "SOUTH", "SOUTH", "EAST", "WEST", "NORTH", "WEST"",
    new String[] { "WEST" },
    DirReduction.dirReduc(new String[] { "NORTH", "SOUTH", "SOUTH",
    "EAST", "WEST", "NORTH", "WEST" }));

    But this works:

    boolean test1 = Arrays.deepEquals(
    new String[] { "WEST" },
    DirectionsReduction.reduce(new String[] { "NORTH", "SOUTH",
    "SOUTH", "EAST", "WEST", "NORTH", "WEST" }));

    assertEquals("First assertion", test1, true);

    Because two arrays of string in Java are equals if they conatins same objects, not equals objects

  • Custom User Avatar

    I don't understand where your problem is. Java tests don't use "equals". Lots and lots of people passed the Java translation without problems. Please can you be more precise?

  • Default User Avatar

    Java JUnits tests has a error. Equals in Java do not work as expected with arrays:

    System.out.println(new String[] { "WEST" }.equals(
    new String[] { "WEST" }));
    --> FALSE

    System.out.println(Arrays.deepEquals(new String[] { "WEST" },
    new String[] { "WEST" }));
    --> TRUE