💡 Original Concept & Implementation: Developed by Vaibhav Singh (BESTEST vaibhav) 🎯
CaseComposer is a test case generation and validation framework that compares the outputs of a correct and incorrect implementation. It automatically identifies discrepancies and logs incorrect outputs.
CaseComposer/
│── tester.py # Main script to run test cases and compare outputs
│── testCaseGenerator.py # Script to generate test cases
│── wrongCases.csv # Stores test cases where the output differs
│── correct.cpp # Correct implementation (reference solution)
│── wrong.cpp # Incorrect implementation (to be tested)
│── notworking.out # Executable for the incorrect implementation
│── working.out # Executable for the correct implementation
│── runCaseComposer.md # Shell script to compile and execute the test framework
│── README.md # Documentation
Ensure you have the following installed:
- Python 3+
- GCC (g++-14 or compatible version)
git clone https://github.com/yourusername/CaseComposer.git
cd CaseComposer- Copy and paste your correct code into
correct.cpp. - Copy and paste your incorrect (to be tested) code into
wrong.cpp. - Make sure both programs take input from
stdinand output results tostdout.
- The test cases are generated using
testCaseGenerator.py. - If you already have a test case generator, copy your logic into this file.
- You can generate a new one using ChatGPT, Gemini, DeepSeek, etc.
- Ensure that the output format matches the expected input of your programs.
g++-14 correct.cpp -o working.out
g++-14 wrong.cpp -o notworking.outpython3 tester.pyAlternatively, you can use the shell script:
bash runCaseComposer.md- You will be asked to enter the number of test cases to generate and evaluate.
- The script generates test cases using
testCaseGenerator.py. - It runs both
working.outandnotworking.outon the same test cases. - The outputs are compared, and discrepancies are logged in
wrongCases.csv. - At the end, you will be asked if you want to see all the incorrect test cases.
As the test cases are being executed, you will see a progress bar indicating the completion percentage, after you enter the number of test cases you wish to test for.
Number of test cases to check (integer): 2
Progress: |██████████████████████████████████████████████████| 100.0% Complete
This helps you monitor the execution status in real time.
If discrepancies are found, they will be logged in wrongCases.csv as:
test case, not working output, working output
1
10 1
2 8 1 8 7 9 2 2 2 3
6 , No , Yes
++++++++++++++++++++++++++++++++++++++++++++++
1
3 1
8 6 8
6 , Yes , No
++++++++++++++++++++++++++++++++++++++++++++++
Additionally, if the user opts to view the incorrect cases, they are displayed as:
------------------------------------------------------------
| Wrong Output Number | Not Working Output | Expected Output |
------------------------------------------------------------
Test Case 1:
----------------
1
5 1
9 8 9 6 10
10
------------------------------------------------------------
| 1 | Yes | No |
------------------------------------------------------------
-
Error:
testCaseGenerator.pynot found!
Ensure the file exists in the directory. -
Error: One of the executables failed to run properly!
Verify the compilation ofcorrect.cppandwrong.cpp. -
Progress bar stuck at 0%
EnsuretestCaseGenerator.pyis generating valid test cases.
This project is open-source under the MIT License.
Feel free to submit pull requests or open issues for improvements!
Happy Testing! 🚀