This is a C++ program for generating testcases for algorithmic problems. The program is designed to generate multiple test cases, each with different constraints, in a single execution.
To run this program, you'll need to have the following installed:
- C++ compiler
- git
- CLI tools to execute your solution code
git clone https://github.com/yashshingade28/testcase_generator.git
To generate testcases, follow these steps:
- Open the generator.cpp file and set the values of
nooftests
andnoofvars
according to the number of test cases and variables you need for your problem. - Set the constraints for each test case in the
constraint
array. Theconstraint
array is a 3D array of integers, where the first dimension represents the test case number, the second dimension represents the variable number, and the third dimension represents the minimum and maximum values of the variable, respectively. For example,constraint[i][j][0]
represents the minimum value of the jth variable for the ith test case, andconstraint[i][j][1]
represents the maximum value of the jth variable for the ith test case. - Write the code to generate the input in the
geninp()
function depending on the input format of the problem. - Initialize the
cmd
string in thegenout()
function with the bash command to execute your solution for the problem. - Save the file and compile it using your C++ compiler.
- Run the compiled executable to generate the input and output files in the input and output folders respectively.
The generated input files will be named inp0.txt, inp1.txt, and so on, while the output files will be named out0.txt, out1.txt, and so on. You can modify the naming convention by changing the inp
& out
strings in the main()
function.
You can check out the example folder for an example on how to use the generator, it contains testcase generation for a sample problem - given two integers output their sum.
If you'd like to contribute to this project, feel free to fork the repository and submit a pull request.
This project is licensed under the MIT License - see the LICENSE.md file for details.