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.
Would you mind explaining to me why the incrementer is necessary? I attempted your solution without the incrementer and it did not go well for me. I'm a bit stuck trying to understand what's going on. Thank you in advance.
Awesome thanks!
Oh sorry, I just realize this is a
Ruby
kata and notJS
>3<Ruby random test cases are like this:
Equality in Ruby are deep comparison by default so you don't need to worry about those stuff in JS, though you still need to watch out for input mutation, especially since stuff that aren't mutable in JS can be mutable in Ruby (e.g String).
Lol I'm loving you both :))
Thank you!! I really appreciate the great information. I was wondering how people managed to get 100 or more tests into their katas :D I'll work through what you have suggested to fix my kata, allthough I'll probably have some questions :)
The CW Github wiki still doesn't have a page for writing random tests, so I'll just write a short explanation here:
You need to generate some random inputs and compare them to the expected answer (usually computed by a reference solution put inside the test fixture. Don't put it in Preloaded!):
Some other things to note:
Object.freeze(Math)
in Preloaded to prevent people hackingMath.random
and sabotage random test generationTest.assertDeepEquals
instead ofTest.assertEquals
to do comparison. And never useTest.expect
unless really necessary.How do I add those? Thanks!
Yes actually I was going to begin with this simple input kata then increase the difficulty of the next by changing the input to an actual date (July 24th, 1995) for instance. Even though this is a digital root exercise, it has a different spin on it and it is not a terrible thing for beginner programmers to get more practice solving these kinds of problems. I actually appreciated being able to practice concepts over and see if I could write the code better with each one when I started programming :)
Thanks for all the feedback everyone! ;)
Yes, you are right;-), haven't found it...
No random tests
Duplicate of https://www.codewars.com/kata/541c8630095125aba6000c00
It's a duplicate of https://www.codewars.com/kata/541c8630095125aba6000c00
So congrats to your first published kata;-)! Wait and see what others say:-)... i'm often too friendly:-P...
Lol, my first one. Should I leave as is?
Looks like a duplicate, but only found some similar ones;-)...
Loading more items...