diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-05-01 16:33:51 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-05-01 16:33:51 +0200 |
| commit | bf44088d4373a9520e860152c56a958332819c4b (patch) | |
| tree | ea35c847a1d82aa715e1fc1c76e4a24462255051 /tests/test_common.h | |
| parent | 1a5bfe9b08707b0aef748d7921a419ba4a046fba (diff) | |
| download | nissy-bf44088d4373a9520e860152c56a958332819c4b.tar.gz nissy-bf44088d4373a9520e860152c56a958332819c4b.zip | |
Split nissy in other repos, see README.md
Diffstat (limited to '')
| -rw-r--r-- | tests/test_common.h | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/tests/test_common.h b/tests/test_common.h deleted file mode 100644 index 03511ef..0000000 --- a/tests/test_common.h +++ /dev/null | |||
| @@ -1,41 +0,0 @@ | |||
| 1 | #ifndef TEST_COMMON_H | ||
| 2 | #define TEST_COMMON_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Common utilities for testing. | ||
| 6 | * A VoidMethod can be used as a setup or teardown method for testing, see | ||
| 7 | * the TestSuite struct. A TestMethod takes a void pointer (usually cast | ||
| 8 | * to some data to be used for testing, but can also be ignored) and returns | ||
| 9 | * a bool: true for pass, false for fail. | ||
| 10 | * A Test consists of a name (string), a TestMethod and an array of void | ||
| 11 | * pointers that describe the test cases. Each element of this array is | ||
| 12 | * passed to the test method sequentially, and the test session stops on | ||
| 13 | * the first failure. | ||
| 14 | * A test suite is just a list of tests with a setup and a teardown method. | ||
| 15 | * The setup method is run once and for all before the first test, and the | ||
| 16 | * teardown is run at the end of the testsuite. | ||
| 17 | * Finally, a TestModule roughly corresponds to a test file. This type is | ||
| 18 | * only used in test.c to collect multiple test modules. | ||
| 19 | */ | ||
| 20 | |||
| 21 | typedef void (*VoidMethod)(void); | ||
| 22 | typedef bool (*TestMethod)(void *); | ||
| 23 | |||
| 24 | typedef struct { | ||
| 25 | char * name; | ||
| 26 | TestMethod t; | ||
| 27 | void ** cases; | ||
| 28 | } Test; | ||
| 29 | |||
| 30 | typedef struct { | ||
| 31 | VoidMethod setup; | ||
| 32 | Test ** tests; | ||
| 33 | VoidMethod teardown; | ||
| 34 | } TestSuite; | ||
| 35 | |||
| 36 | typedef struct { | ||
| 37 | char * name; | ||
| 38 | TestSuite ** suites; | ||
| 39 | } TestModule; | ||
| 40 | |||
| 41 | #endif | ||
