Code examples used for the A Tale of Debugging: The Competitive Programmer Approach (Part II) article in Hashnode.
In case you want to try the solution you can follow these steps:
-
Replace the code in
./generators/random_generator.py
for the test case generator suitable for your use case. -
Replace the code in
./solutions/solution.py
with the code that you want to test. -
Replace the code in
./solutions/naive.py
with the naive solution for the problem you are trying to solve. -
Run the checker scripts:
-
Using
shell
: Execute the following command in the root of the project../check.sh
-
Using
python
: Execute the following command in the root of the project.python3 check.py --test-cases 100 --generator-path ./generators/random_generator.py --solution-path ./solutions/correct.py --naive-path ./solutions/naive.py --tests-path ./test_cases
The arguments in the
python
are customizable. For example, the--test-cases
argument can be changed to try with more or less cases. The arguments that are paths can be changed as well. Be careful when doing this, the specified paths should exist.
-
List of future improvements:
- Make it work not only for python solutions/generators.