NOTE: Make sure
nodeandg++is installed.
- Clone the repository.
git clone https://github.com/JayjeetAtGithub/wecp-task
cd wecp-task/
- Compile the sample C++ programs and keep the generated binaries in a
bin/directory.
mkdir -p bin/
g++ example/sample_program_one.cpp -o bin/sample_program_one
g++ example/sample_program_two.cpp -o bin/sample_program_two
- Run the code.
node index.js
- Define an input generator function.
const input_generator_function = function() {
// return the input in the form of a string.
// .
// .
return input_string;
}- Pass the input generator function along with other params to the
TestCaseGenerator.
let test_case_generator = new TestCaseGenerator(
"<path/to/program/binary>",
"<path/to/test case input file>",
"<path/to/test case output file>",
input_generator_function,
number_of_test_cases_to_generate)- Call the
generatemethod.
test_case_generator.generate()input_one.txt,output_one.txt: Test cases forexample/sample_program_one.cpp.input_two.txt,output_two.txt: Test cases forexample/sample_program_two.cpp.