summaryrefslogtreecommitdiffstats
path: root/web/input/doc/faq/extra-tests.md
blob: 89db225dfa68081ad0154e33d617888c37b92a4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
title: Testing C routines
parent: FAQ
---

# Can I add extra tests to the C routines?

The idea with the testing is to move as many functions as possible "lower
down"; i.e., to the `lib/utils_*.c` files.  These functions can then be tested
using the libtap routines in the `lib/tests/test_*.c` files.  It is easier to
do unit testing here than to try and do higher level plugin testing, because
you can fake data easier at this level.

The routines available via [libtap][libtap] are equivalent to Perl's
[Test::Simple][test-simple] ones.

The libtap tests are separated out from the plugins ones (in `plugins/t`)
because:

1. They are testing the files in `lib/`, so should reside there.
2. They require [compiling][compilation] to run.

[libtap]: http://jc.ngo.org.uk/trac-bin/trac.cgi/wiki/LibTap "libtap"
[test-simple]: http://search.cpan.org/dist/Test-Simple/lib/Test/Simple.pm "Test::Simple Module"
[compilation]: doc/faq/compilation.html "Compilation"

<!--% # vim:set filetype=markdown textwidth=78 joinspaces expandtab: # %-->