A test case is composed of 2 tests:
- a test in the IDE for players to test their code against a specific scenario
- a test, called validator to validate the same kind of scenario
IDE tests are visible to the players whereas validators are hidden.
Guidelines for writing test cases
- Test cases should cover all specifications
The more tests, the better.
- Each validator must* differ from the corresponding test
It's only to ensure that the players don't hardcode the solution. * Sometimes, to cover edge cases, there is no other way than having the same test as validator
- Each validator should check the same case as the corresponding test
They work by pairs.
- The first test case must be a simple one
It's included in the statement as the example.
Best Practices
- It is useful to give explicit names to test cases to help players quickly understand their purpose
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Suggested playgrounds