-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfixture.c
More file actions
49 lines (37 loc) · 708 Bytes
/
fixture.c
File metadata and controls
49 lines (37 loc) · 708 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
42
43
44
45
46
47
48
#define CTEST_IMPLEMENTATION
#include "ctest.h"
typedef struct {
int param;
} Fixture;
TEST_F_INIT(Fixture) {
LOG("Init fixture\n");
self->param = 42;
}
TEST_F_DROP(Fixture) {
LOG("Drop fixture\n");
self->param = -42;
}
TEST_F(Fixture, Test1) {
EXPECT_EQ(self->param, 42);
}
TEST_F(Fixture, Test2) {
EXPECT_EQ(self->param, 43);
}
TEST_F(Fixture, Test3) {
ASSERT_EQ(self->param, 43);
}
typedef int DummyFixture;
TEST_F(DummyFixture, Test1) {
EXPECT_EQ(2, 2);
}
typedef struct {
int _;
} SkipFixture;
TEST_F_INIT(SkipFixture) {
LOG("Init SkipFixture\n");
SKIP();
}
TEST_F(SkipFixture, Test1) {
EXPECT_EQ(41, 42); // never executed
}
CTEST_MAIN()