-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathtest.c
More file actions
41 lines (32 loc) · 1019 Bytes
/
test.c
File metadata and controls
41 lines (32 loc) · 1019 Bytes
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
//============================================================================
// ET: embedded test; very simple test example
//============================================================================
#include "sum.h" // Code Under Test (CUT)
#include "et.h" // ET: embedded test
void setup(void) {
// executed before *every* non-skipped test
}
void teardown(void) {
// executed after *every* non-skipped and non-failing test
}
// test group ----------------------------------------------------------------
TEST_GROUP("Basic") {
TEST("first test (passing)") {
VERIFY(4 == 2*2);
}
TEST("CUT test (passing)") {
VERIFY(5 == sum(2, 3));
VERIFY(5 == sum(3, 2));
}
SKIP_TEST("test (skipped)") {
VERIFY(3 == 2*2); // this would fail, but it's not checked
}
TEST("CUT test (failing)") {
VERIFY(5 == sum(2, 3));
VERIFY(4 == sum(3, 2)); // <--- fails
}
// this test follows a failing test and is NOT executed
TEST("simple test (passing)") {
VERIFY(4 == 2*2);
}
} // TEST_GROUP()