blob: 43d61105660d1ddca218efa24043587ed6a40822 (
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
Testing
---
File Layout:
The test files mirror the src files, so a function in src/file.c would have a test in test/file.c
---
Includes:
#include "kpl_test.h"
This is the only include a .c file in the test folder needs
---
Writing Tests:
TEST(test_name) {
// TEST CODE
}
Tests pass by default
---
Asserting:
ASSERT(CONDITION, FAIL_MESSAGE);
---
Failing:
FAIL(FAIL_MESSAGE);
---
Building:
make kpl_test # build test exec
make kpl_test_memory # build test exec with address, leak and undefined sanitizer
make kpl_test_thread # build test exec with thread sanitizer
All objects need to be built with the same sanitizer and do not run valgrind when sanitizers are added
---
Running:
./kpl_test # Run all tests
./kpl_test NAME # Run test named NAME
./kpl_test NAME1 NAME2 ... # Run selected tests named NAM1 NAME2 ...
./kpl_test -h # Show help
---
Compiler Flags:
---
|