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.
.
Why is this not considered best practice?
Approved
Exactly, that's why even I am struggling to understand.
Ok, I misread you. Though, adding a single test is not a solution, it's easy to hardcode it, the solution would be make sure random tests generate values making this code fail, but, like I was saying, I'm not sure your wrong approach is sufficiently common to consider it's an issue for the kata.
Your solution being buggy and needing a special check to pass the tests is not a kata issue, unless you demostrate a significant number of other solutions have the same problem. It's hardly possible to make tests able to catch all the kinds of minor possible mistakes.
@najamelan: in general, fixed tests don't aim to catch edge cases. They aim to help the user control his code with a certain number of representative values so he can debug it more easily and improve it. When there are a great amount of possible edge cases, like here, using fixed tests is definitely not the right way to do. Though, it may be a good idea to add the examples you give as fixed tests, but it's not enough.
With 300 tests like we have here it's possible to make tests that will generate a certain number of those 3 cases with an extremely high probability (with 99.9%, that would mean a user would need to subm,it a wrong code about 1000 times for it to pass... ok. We're talking about a relatively basic 7 kyu...). Still if you are paranoid, it's also possible to make it sure. It's just a bit annoying to write...
I was talking about this:
Any idea how to make that happen then?
akar-0 is still right about random tests, though. they should "hold the fort" on their own.
A better solution would be to make random tests occasionnally generate such values, fixed-tests can always be hardcoded.
Could you give examples of codes that can pass all tests but fail on these ones?
This comment is hidden because it contains spoiler information about the solution
Ok, should be fixed now! :)
Loading more items...