-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtest_matcher_null.cpp
79 lines (63 loc) · 1.3 KB
/
test_matcher_null.cpp
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include "../source/h2_unit.cpp"
#include "test_types.hpp"
SUITE(NULL)
{
Case(NULL)
{
OK(NULL, 0);
OK(nullptr, 0);
const char* a1 = nullptr;
OK(NULL, a1);
OK(nullptr, a1);
int* a2 = nullptr;
OK(NULL, a2);
OK(nullptr, a2);
void* a3 = nullptr;
OK(NULL, a3);
OK(nullptr, a3);
std::shared_ptr<int> a4;
OK(NULL, a4);
OK(nullptr, a4);
}
Case(Not NULL)
{
OK(Not(NULL), 1234);
OK(Not(nullptr), 1234);
const char* a1 = "";
OK(Not(NULL), a1);
OK(Not(nullptr), a1);
int* a2 = (int*)1234;
OK(Not(NULL), a2);
OK(Not(nullptr), a2);
void* a3 = (void*)1234;
OK(Not(NULL), a3);
OK(Not(nullptr), a3);
}
Case(Nq NULL)
{
OK(Nq(NULL), 1234);
OK(Nq(nullptr), 1234);
const char* a1 = "";
OK(Nq(NULL), a1);
OK(Nq(nullptr), a1);
int* a2 = (int*)1234;
OK(Nq(NULL), a2);
OK(Nq(nullptr), a2);
void* a3 = (void*)1234;
OK(Nq(NULL), a3);
OK(Nq(nullptr), a3);
}
Case(NULL nullptr)
{
OK(NULL, nullptr);
}
Case(nullptr NULL)
{
OK(nullptr, NULL);
}
Case(MOCK)
{
MOCK(foobar2, int(int, const char*)).Once(true, NULL).Return(11);
OK(11, foobar2(1, nullptr));
}
}