You need to sign in or sign up before continuing.×
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.
It's been a while so you've probably learned this, but you can change the tests.
Forked because original translator inactive.
I'm fairly sure your "statistics" are off:
There are 62 alphanumeric characters in the ASCII range 0..127, so roughly 50%. So, each time you randomly sample that range, you have a ~50% chance of getting an alphanumeric character. However, repeatedly sampling
n
times, each individually with 0.5 probability, means you have a total probability of0.5 ^ n
that the final string is completely comprised of alphanumeric characters.Oh, on another note, make sure your custom assertion messages start with a newline
\n
or else they will be concatenated directly after the existing assertion output, which looks bad.It doesn't fail the test case so it's technically fine 🤷
I already know a few ways to improve this, but I'm going to have someone else make the first move
Another issue I didn't mention the first time around:
todo!
should be preferred overunimplemented!
, because semantically, the former implies that it should be replaced with a working implementation, whereas the latter means "this function exists, but doesn't (and never will) do anything".I used macros becuase I think it makes the tests more readable.
&str
, not&String
(this would avoid the extra allocation in your macro (.to_string()
)&str
and an expected boolean value and ran the assertion with them would suffice and be easier to read, especially in the sample tests which are user-facing.