The parabix-devel/QA
directory contains a number of testing scripts and data files.
To test icgrep
, greptest.py
can be used. It works with a file specifying test cases, such as greptest.xml
.
Inside greptest.xml
, you can include sample test files for grep searches using the datafile
element. For example, the test file simple1
is declared as follows.
<datafile id="simple1">
A few lines of input
in this simple test file
provide fodder for some simple
regexp tests.
</datafile>
Test cases can then be written with the grepcase
element.
For example, an icgrep
search using the regular expression fe|si
should return matches for lines 2, 3 and 4 of the test file simple1
. This is declared using the following grepcase
element.
<grepcase regexp="fe|si" datafile="simple1" greplines="2 3 4"/>
Any tests included in greptest.xml
are automatically run as part of the make check
process.
You can also run tests directly from the parabix-devel/QA directory. For example, if you want to run the tests, but print out the expected and actual input and output each time, you can use the following commands.
cd QA
python greptest.py -v ../build/bin/icgrep
You can also use different files of test cases. For example, to test using the proptest.xml
file and testfiles in the QA directory, the following command may be used.
python greptest.py -t proptest.xml -d . ../build/bin/icgrep
When using greptest.py
in verbose mode, you may see that test cases are often executed with extra command line parameters. This is a combinatorial testing strategy. This can be controlled with parameters to greptest. For more thorough testing you can try the following command.
python greptest.py -v --random_flag_count=3 --tests_per_grepcase=5 ../build/bin/icgrep