Sometimes there are benefits on writing unit tests for your solutions both while training and in competition setups. One of the goals of this repository is to simplify that process.
In order to do so, hereby is provided a class that enables the automatic execution and debugging of your code using test cases provided in text files.
- Make sure that you have Java JDK 9 or above installed.
- Setup your JDK in your IntelliJ. (Ctrl+Alt+Shift+S)
- Create Test Cases:
- Test cases start at 0 because we are real programmers.
- Each test case should have an input file (with
.in
extension) and the expected output in another file (with.out
extension) in the same folder as the main class. - Then update the
config.properties
file with the number of test cases and the main class settings.
- Run the
TestExecutor.main
function using the IDE. If it fails it will output where it did fail.
If it fails in the tests you can put breakpoints in your main class and run the tests again.