Package: pvcheck
pvcheckpvcheck is a tool that automates the testing of computer programs by checking the textual output of the program under testing with a set of user-defined test cases.pvcheck has been developed to be used as automatic correction tool in the courses of Principles of Computer Programming at the University of Pavia.Requirementspvcheck requires a Python interpreter and can be executed as a standalone application.
The current version has been tested with Python 3.4.3.InstallationTo install pvcheck:pip install pvcheckTo compile all the sample programs:cd examples
makeUsagepvcheck has 3 main arguments (run,infoandexport) .helpTo see the main help:pvcheck -horpvcheck --helpTo see the help of a specific command:pvcheck argument -horpvcheck argument --helptherun argumentThe run argument, being the default argument, also works without explicit invocation. Sopvcheck run ./programis the same as:pvcheck ./programtest a program with a default test fileIf you have atest filewith the default namepvcheck.testlocated in the pvcheck folder, you can test your program simply by using:pvcheck ./programtest a program with any test fileIf you want to test a program using a specifictest file:pvcheck -f testfile ./programpvcheck --file testfile ./programtest a program with a specific test of a test suiteIf you want to test a program using a specific test contained in a test suite, you can use theinfo argumentto list all the available tests. Then you can use:pvcheck -T testnumber ./programpvcheck --test testnumber ./programto use only the desired test.select a different output formatpvcheck lets you choose the output format. The formats available arejson, csv and html. To choose the ouput format:pvcheck -F format ./programpvcheck --format format ./programchange timeoutYou can set how many seconds it should be waited for the termination of the program:pvcheck -t timeout ./programpvcheck --timeout timeout ./programThe default is 10 seconds.change the number of reported errorsTo report up to N errors per section:pvcheck -e N ./programpvcheck --errors N ./programThe default is 4.set the verbosity levelTo set the verbosity level, where the level must be an integer between 0 (minimum) and 4 (maximum):pvcheck -v verbositylevel ./programpvcheck --verbosity verbositylevel ./programThe default is 3.use valgrindTo use Valgrind (if installed) to check memory usage:pvcheck -V ./programpvcheck --valgrind ./programuse a log fileTo specify the name of the file used for logging:pvcheck -l logfile ./programpvcheck --log logfile ./programThe default is ~/.pvcheck.log.set an output limitTo cut the output of the program to a maximum of L lines:pvcheck -L L ./programpvcheck --output_limit L ./programThe default is 10000.use a configuration fileTo use the specified configuration file:pvcheck -c configurationfile ./programpvcheck --config configurationfile ./programchange output color settingTo enable or disable colored output:pvcheck -C option ./programpvcheck --color option ./programThe options available areYES,NOandAUTO. The default value isAUTO.theinfo argumentThe info argument lists all the available tests in a test file.To see all the tests available in a test file:pvcheck info testfiletheexport argumentThe export argument allows you to export in a file the input arguments from the selected test.To export the input argument from a test, you can use theinfo argumentto list all the available tests. Then you can use:pvcheck export testnumber testfileThe output file is saved into the current directory with the name testname.dat .Test FiledescriptionA test file is a file which contains one or more test cases.Tests are divided in sections with names between square brackets.Empty lines, and lines starting with '#' are ignored.Non-empty lines are compared against those produced by the program in the corresponding section.The format of test definition files is rather simple.
The following examples include comments to concisely describe the various aspects of the format:single test casemultiple test casesmultiple output linestemporary filesspecial sectionsthe special section [.SECTIONS]The special section [.SECTIONS] allows to specify additional options for the sections.
Options are usually declared at the beginning of the test file, or in a separate configuration file.For example:...

[SECTION1]
...

[.SECTIONS]
SECTION2 unordered

[SECTION2]
...indicates that the order of the lines in the SECTION2 section is not relevant.the special section [.TEST]In case of multiple tests, each test is introduced by the special section [.TEST] followed by the name of the test.Example:...

[.TEST]
Test1

[SECTION1]
...

[SECTION2]
...

[.TEST]
Test2

[SECTION1]
...

[SECTION2]
...Common parts among all the test cases (for instance options in the [.SECTIONS] special section) can be specified before the first [.TEST] section. They will be prepended to all the tests.the special section [.INPUT]The special section [.INPUT] allows to specify the text to be written on the program's standard input:Example:...

[.TEST]
Name of the test

[.INPUT]
input1
input2
...

[SECTION1]
...

[SECTION2]
...

[.TEST]
Thi is another test

[.INPUT]
input3
input4
...

[SECTION1]
...

[SECTION2]
...the special section [.ARGS]The special section [.ARGS] allows to specify additional arguments to be passed on the command line, one extra argument per line.Example:...

[.TEST]
Test1

[.ARGS]
arg1
arg2
...

[SECTION1]
...

[SECTION2]
...

[.TEST]
Test2

[.ARGS]
arg3
arg4
...

[SECTION1]
...

[SECTION2]
...the special section [.FILE]The special section [.FILE] shall be used together with the special section [.ARGS].
When the special argument ".FILE" is present in the [.ARGS] section, a temporary file is automatically generated and filled with the content of the text in the [.FILE] section.
The name of the temporary file is passed on the command line of the program under test.Example:...

[.ARGS]
.FILE
...

[.TEST]
Test1

[.FILE]
first line written in the temporary file used for Test1
second line written in the temporary file used for Test1
...

[SECTION1]
...

[SECTION2]
...

[.TEST]
Test2

[.FILE]
first line written in the temporary file used for Test2
second line written in the temporary file used for Test2
...

[SECTION1]
...

[SECTION2]
...WikiFor more information, please visit thewikiof the project.