Quite often, as a competitive programmer, I feel irritated when an easy problem yields WA because of a teeny-tiny bug like a typo or a missing initialisation. It often costs a lot of precious time and several penalties.
For this problem, I’ve designed a small, simple, easy-to-use GUI application in Java which takes two source codes and tests them against a common input. The respective outputs obtained are then compared line by line for a mismatch. One can compare the ‘buggy’ code with a brute force solution to obtain a test case in which the faulty solution fails.
Ask for time limit while taking input and break it if it exceeds time limit. ( if you already have that feature then just ask for time limits. I fear to try it as there is no stop button in your program XD.)
PS: If you can’t do this just give a stop button otherwise it will make hard disk and memory full.(due to infinite loops)
2) Different time limits for both codes would be great.
Usually people have one brute force solution and one optimized one so a feature where I can give different time limits for both test files will be great.
3) Ask for number of times “N” to run on generate test file feature.
Idea is keep generating test cases till either you find a mismatch in answers or it is already executed N times.
Because people will need to run it multiple times with a program which generates inputs using random functions.
Codeforces questions generally don’t have test cases. So it will be easier to use this if you can include this.
Edit:- A stop button is useful for this one as it can be slower. Also showing how many times it is executed is better as we can estimate that how much time it’s gonna take more.
PS: I understand that this can be done with test case but sometimes it’s tough to find that particular test case in generated output/input file (specially when you are in a short contest) and also there can be some programs where including test cases is not feasible due to running contest (specially in short contests) or due to toughness of including test cases in that program or for checking time constraints.
Also Thank you so much for making this bug finder. It’s really a universal bug finder if you can implement above ideas.
I just have a simple bash script for this kind of thing. Essentially I always have a gen.py for test generation and brute.py as a reference solution. Based on that my script does a lot of things. It can generate cases, generate answers for cases and test my solution against the generated cases. Additionally it has convenience features like stress tests (i.e. throw generated cases against solution and brute until the output differs) and performance tests (i.e. throw large generated solutions at the solution and time it).
“A stop button is useful for this one as it can be slower. Also showing how many times it is executed is better as we can estimate that how much time it’s gonna take more.” - This stop button is probably the only thing left to add.
Please test the application and report any bug you find.
For the longest time I just re-wrote the same loops for stress testing as one-liners in bash. Then I grew tired of it and put the typical things I used in a script, and then it’s just some minor improvements over time.