| 1 |
This is the test suite for netcfg. At present, it is no more than a set of |
| 2 |
regression tests to ensure that refactoring and other invasive changes don't |
| 3 |
break existing functionality more than can be helped. |
| 4 |
|
| 5 |
Since the test suite does not comprehensively cover the entire codebase, it |
| 6 |
should not be run at package build time. It is a development aid *only*. |
| 7 |
|
| 8 |
|
| 9 |
Running the tests |
| 10 |
----------------- |
| 11 |
|
| 12 |
Ensure you have the 'check' package installed, and run 'make test'. |
| 13 |
Everything should sort itself out from there automatically. |
| 14 |
|
| 15 |
|
| 16 |
Adding tests |
| 17 |
------------ |
| 18 |
|
| 19 |
See http://check.sourceforge.net/doc/check_html/index.html for documentation |
| 20 |
on how to use Check (the unit testing tool in use). |
| 21 |
|
| 22 |
Tests are grouped in files named after the function they test, prepended |
| 23 |
with 'test_' and with the standard '.c' suffix. So tests for the inet_mton |
| 24 |
function go in 'test_inet_mton.c'. |
| 25 |
|
| 26 |
To add a new test for a function with existing tests, create a new test case |
| 27 |
in the appropriate file (see existing tests for an idea of the structure), |
| 28 |
then add a new 'tcase_add_test' line to the 'suite' function at the bottom |
| 29 |
of the file. |
| 30 |
|
| 31 |
To add tests for a function that doesn't already have tests, make a new |
| 32 |
file, create a new skeleton matching that of an existing test file, add an |
| 33 |
entry in the TESTS list in test/tests.mk, and then add a prototype for the |
| 34 |
suite function to srunner.h and an 'srunner_add_suite' line in srunner.c. |
| 35 |
Simple! |