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.
Enjoyed the kata. The finish under 5ms test was kinda clunky. Got 5ms exactly few times in a row (failed) and than it passed.
I like the symmetry of the two functions.
This comment is hidden because it contains spoiler information about the solution
I need advice on how to test whether the user has actually generated random output (rather than cheating by hard-coding output that merely looks like it could be random).
I see that you are testing for this with the .expect() method in one of your it blocks. And I understand that you are checking to see whether the frequency of a given value in the output is approximately equal to its probability (weight). So far, so good.
But here's what I don't get: How does your test framework make the user's attempted solution run multiple times, so that you can determine how frequently each value occurs?
The kata I am considering would only ask the user to generate one set of random output data, but it looks like my test framework would somehow have to make their solution execute multiple times to determine whether it is likely to be randomly generated. I'm just not sure how to do that.
This comment is hidden because it contains spoiler information about the solution
If the tests time out they are anything but fine!
Even a simple function like the following doesn't complete in the alotted 12 seconds...
So anyone trying the kata can't even debug the tests.
Awesome. Thanks.
Interestingly, my code just works now, with no failed tests at all. @.@
I have updated tests to include more information about what is being tested. Hope that makes them more clear.
Alright, I resolved this issue. I was making the mistake of testing implementation rather than output.
Math.random
is no longer being stubbed.Thanks for the input. I'll see what I can do about adding more expressive tests.
(I'd love to complete this kata, as it's a problem I've thought about figuring out in the past.)
I'd really appreciate some more messages on the tests. I'm stuck on the
should use the provided weights to control probability
tests. It's pretty hard to figure out what "expected 5 to equal 4" is referring to, and so doubly hard to debug from it ;PThis comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Loading more items...