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.
Yea, looking back at this and what I implemented was not great. Haha. I have refactored the code such that it only references the function and removed all that companion object stuff. Also I removed the complicated tests and just left a simple test that expects given inputs and expected outcomes. Let me know what you think. Thanks
Kotlin Translation kumited. Please review and approve if all is well with thee.
For Kotlin, could you make some changes to the test Class and remove the semicolons and also the unused import
import java.util.Random
. I noticed that if I copy and paste with the semicolon, some IDEs will think it is a Java Class rather than a Kotlin Class.I've put the edit below:
For Java, the method signature should be:
yours is void and won't return anything.
You unit tests should take the format of
assertEquals('expected value here', AngleSum.sumOfAngles(3));
Also the parameter should specify the type which is
int
. currently it'spublic int nearestSq(n){}
when it should bepublic static int nearestSq(int n){}
Your tests are in the wrong format:
org.junit.Assert.assertEquals("expected", "actual");
. You have this the other way around.Your tests are the wrong way round they should follow this format
assertArrayEquals(int[] expected, int[] actual);
.Your tests are the other way round in this case:
which is not consistent to what you said:
You will be given an array which will have three values (tail, body, head). It is your job to re-arrange the array so that the animal is the right way round (head, body, tail).
. You're passing the correct values to thefixTheMeerkat()
method.