This repository contains scripts for stress testing competitive programming solutions. The goal is to find hidden bugs and edge cases by generating random test inputs, running multiple solutions, and comparing outputs.
- Test Case Generator: Create random inputs within given constraints.
- Multiple Solutions Comparison: Compare outputs from a brute-force (correct) and an optimized solution.
- Automated Loop: Continuously run tests until a mismatch is found.
- Easy Setup: Simple to use with C++ solutions, can be adapted for other languages.
Stress-Testing/
│
├── bruteforces.cpp # Brute-force or correct solution which you create a naive or always corret solution
├── efficient.cpp # Optimized or suspected buggy solution which you paste your optimise code for determine your test where your code is Wrong
├── gen.cpp # Generates random test cases
├── checker.sh # Main stress testing script
├── in.txt # Wrong answer Test Case
└── README.md # Documentation
- C++ Compiler (g++)
- Basic knowledge of compiling and running C++ programs.
- Basic Knowledge of running bash file
git clone https://github.com/mostafa-cse/Stress-Testing.git
cd Stress-Testing
- gen.cpp → Generates test cases.
- bruteforces.cpp → Verified correct solution.
- efficient.cpp → Optimized or solution to test.
bash checker.sh
When a difference is found, the loop stops and shows the failing case.
- Generate random input.
- Run bruteforces solution and efficient solution on the same input.
- Compare outputs.
- Stop when mismatch occurs → investigate bug.
Test #1 : Accepted!
Test #2 : Accepted!
Test #3 : Accepted!
Test #4 : Accepted!
Test #5 : Accepted!
Test #6 : Accepted!
Test #7 : Mismatch found!
Input was:
94414 46193
Bruteforces output:
4361265902
Efficient output:
66298606
Feel free to fork this repo and improve it (e.g.adding better generators).
