Skip to content

Test-Cases is a shell script that compiles and test given C++ file on given test cases in a text file and print the output of each test case into a new text file.

License

Notifications You must be signed in to change notification settings

Abd3lwahab/Test-Cases

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

Test-Cases

Test-Cases is a shell script that compiles and test given C++ file on given test cases in a text file and print the output of each test case into a new text file.

Installation

git clone https://github.com/Abdelwahab07/Test-Cases.git
cd Test-Cases
./Test-Cases.sh 

If you got the following error:

bash: ./Test-Cases.sh: Permission denied

Enter the following command:

chmod +x Test-Cases.sh

Usage

./Test-Cases.sh [CPPFILE] [TestCasesFILE]

The script should run with two command-line arguments:

  • CPPFILE: is the name of the C++ file with extension ".cpp" that will be able to compile.
  • TestCasesFILE: is the name of a text file that includes test cases that will testing on the program.

The script should run in the same directory with the C++ file and test cases file.

Run from anywhere

If you want to run the script from anywhere and avoid copying the script each time to the same folder with C++ and test cases file. Add the script to your PATH by this command:

sudo mv Test-Cases.sh /usr/local/bin

Then you will be able to run the script from anywhere and you will not need to write “./” and use it as follows:

Test-Cases.sh [CPPFILE] [TestCasesFILE]

Format of Test Cases File

  • Add an empty line between each test case.
  • It allows the test case to be in more than one line.
  • Add two empty lines after the last test case.

Example:

Test Case 1
Continue Test Case 1

Test Case 2
Continue Test Case 2


The Output will save in file called 'output.txt' with information about each test case and its result.

Notice: g ++ compiler should be installed and these are the default flags and can be modified on line 40 in the script.
g++ -pipe -O2 -std=c++14 -lm

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT
Copyright (c) 2020 Abdelwahab Hussein

About

Test-Cases is a shell script that compiles and test given C++ file on given test cases in a text file and print the output of each test case into a new text file.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages