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.
duplicate!
A first step towards randomized tests could be to create an input set, which you could then let the test randomly choose from. I have myself no idea how to generate a valid magic square (but have a look at e.g. wikipedia).
Hi thanks for the feedback! Thats a very good point however I am slightly unsure how to create a random test generator? Obviously I need to randomly create the input and then compare the user solution to my own solution! However this being my first kata I am still learning and don't know how to do this yet? Can you point me in the right direction to anything that might help me write my random tests please?
Please, don't ever use
Test.expect()
without a customized error message upon failure. The default error message shown to the user whenTest.expect()
fails is"Value is not what was expected"
which provides no useful feedback whatsoever for debugging. Even adding a simple message as"The 3 by 3 matrix [[1,1,1], [1,1,1], [1,1,1]] is not a magic square!"
(upon failure) would be helpful.Your Kata needs more extensive test coverage to prevent easy cheap-cheat solutions and/or logically flawed solutions. The most common way to increase test coverage is through the inclusion of randomly generated test cases at runtime so please add these. The lack of test coverage in a Kata as an Issue is recognised as an official CW stance.
Think about the fact that your counter is a global variable