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.
The Rust translation needs some work.
tests
module with#[cfg(test)]
&[_]
is more idiomatic and flexible and should always be preferred over&Vec<_>
-> ()
return type is moot and discouraged.[a, b, c]
instead of[ a,b,c ]
.todo!()
macro is a more idiomatic way to mark unwritten code, rather than a comment that fails compilation.i64
s and returns 1 isfn(i64, i64) -> i64
. The user shouldn't have to write their own function signatures.Updated
You apparently need to merge the current description into this fork. Otherwise, I can't approve it.
Description cannot be approved, recent changes from related record must be merged first.
Rust tests are run in parallel with nondeterministic ordering, though with only two of them it would be easier enough to submit until such a solution passed. Added random tests.
Random tests just need to ensure that you can't hardcode the solution based on the order of tests.
A function that returns 52 times true followed by 43 times false would be able to pass the fixed tests.
See https://docs.codewars.com/authoring/guidelines/submission-tests/#random-tests
I've improved the non-sample assertion messages.
Random tests don't do anything if the test coverage is exhaustive. Though I might have missed some characters, so please let me know. I'm assuming only ascii printable characters are included.
Could you add some random tests and assertion messages?
The messages for the sample tests are probably fine, but the others just say
assertion failed: is_it_letter(c)
.You could do it like this:
assert!(is_it_letter(c), "is_it_letter('{}') wasn't true", c);
.Good work!
A few notes if you're interested (ignore if not):
()
return type is typically omittedassert_eq!
are already equivalent toformat!
Forked with these changes and a few more. Feel free to ask me if you have any questions.
I had no idea. Thanks for letting me know.
Also made a typo trying to type "typo".
Thanks for updating stale translations. I've approved a downstream fork.
For future reference: unless the reference solution is wrong/buggy or not performant enough, there's no reason to change it with your own in a fork; when the translation is approved, the solution (with your changes!) will show up under the original author's name, not yours. I'm sure you'll understand why it's undesirable to publish code in someone else's name.
Fixed type in assertions.
More precisely used array of length 5 instead of slice, improved the error meesage, and general formatting improvements.
My only uncertainty is whether, when showing assertion failures, it's better to print
or
I currently do the former.
Yeah, probably. I remember wondering about that when I wrote it. Then the tests all came back green and I forgot about it and moved on.
Loading more items...