This repository contains a framework for stress testing solutions to competitive programming problems. It includes a naive solution for generating expected outputs and a checker for comparing outputs.
/project-root
│
├── /tests
│ ├── /input # Directory containing input test cases
│ ├── /expected_output # Directory for storing expected outputs
│ └── /actual_output # Directory for storing actual outputs generated by the solution
│
├── /logs
│ ├── /checker_logs # Directory for storing logs from the checker
│ └── /test_logs # Directory for storing logs of test runs
│
├── checker.cpp # Program to compare actual and expected outputs
├── naive.cpp # Naive solution for generating expected outputs
├── solution.cpp # Optimized solution to be tested
├── test_gen.cpp # Program to generate random test cases
└── stress_test.sh # Bash script to run the stress tests
Make sure you have the following installed:
- A C++ compiler (e.g., g++)
- Bash (for running the script)
Before running the tests, compile all the necessary programs with the following command:
g++ solution.cpp -o solution
g++ naive.cpp -o naive
g++ test_gen.cpp -o test_gen
g++ checker.cpp -o checker
Alternatively, you can use the provided stress_test.sh
script to compile all programs automatically.
Place your input test cases in the tests/input
directory. You can also modify test_gen.cpp
to customize the test case generation logic.
To run the stress tests, execute the following command:
./stress_test.sh
This script will:
- Compile all necessary programs.
- Generate test cases.
- Run the tests, capturing actual outputs and comparing them with expected outputs.
- Create logs for each test case in the
logs
directory.
After running the tests, you can check the results:
- Logs for each test case can be found in the
logs/test_logs
directory. - Logs from the checker can be found in the
logs/checker_logs
directory.
The log files will contain the following information:
- Test case name and pass/fail status
- Input used for the test
- Expected output
- Actual output
Feel free to contribute by adding new test cases, improving the naive solution, or enhancing the checker program.
This project is licensed under the MIT License. See the LICENSE file for details.