|
|
|
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
|
|
|
|
``` |