Skip to content

Latest commit

 

History

History
83 lines (60 loc) · 2.66 KB

README.md

File metadata and controls

83 lines (60 loc) · 2.66 KB

Stress Testing Setup for Competitive Programming Solutions

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.

Directory Structure

/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

Prerequisites

Make sure you have the following installed:

  • A C++ compiler (e.g., g++)
  • Bash (for running the script)

Compiling the Programs

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.

Generating Test Cases

Place your input test cases in the tests/input directory. You can also modify test_gen.cpp to customize the test case generation logic.

Running the Stress Tests

To run the stress tests, execute the following command:

./stress_test.sh

This script will:

  1. Compile all necessary programs.
  2. Generate test cases.
  3. Run the tests, capturing actual outputs and comparing them with expected outputs.
  4. Create logs for each test case in the logs directory.

Viewing the Results

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.

Example of Log Output

The log files will contain the following information:

  • Test case name and pass/fail status
  • Input used for the test
  • Expected output
  • Actual output

Contributing

Feel free to contribute by adding new test cases, improving the naive solution, or enhancing the checker program.

License

This project is licensed under the MIT License. See the LICENSE file for details.