Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
The same here.
Hi, I've nearly done it, but on test 11 i get this error "Expected: -1, instead got: 1..9", any ideas why? Cheers
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 ?
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.
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
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?
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