• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2023 The Pigweed Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
5 // the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
13 // the License.
14 #pragma once
15 
16 #include "pw_unit_test/framework_backend.h"  // IWYU pragma: export
17 // Check that the backend defined the following.
18 
19 #ifndef GTEST_TEST
20 #error \
21     "The pw_unit_test framework backend must define " \
22     "GTEST_TEST(test_suite_name, test_name)"
23 #endif  // GTEST_TEST
24 
25 #ifndef TEST
26 #error \
27     "The pw_unit_test framework backend must define " \
28     "TEST(test_suite_name, test_name)"
29 #endif  // TEST
30 
31 #ifndef TEST_F
32 #error \
33     "The pw_unit_test framework backend must define " \
34     "TEST_F(test_fixture, test_name)"
35 #endif  // TEST_F
36 
37 #ifndef FRIEND_TEST
38 #error \
39     "The pw_unit_test framework backend must define " \
40     "FRIEND_TEST(test_suite_name, test_name)"
41 #endif  // FRIEND_TEST
42 
43 #ifndef EXPECT_TRUE
44 #error "The pw_unit_test framework backend must define EXPECT_TRUE(expr)"
45 #endif  // EXPECT_TRUE
46 
47 #ifndef EXPECT_FALSE
48 #error "The pw_unit_test framework backend must define EXPECT_FALSE(expr)"
49 #endif  // EXPECT_FALSE
50 
51 #ifndef EXPECT_EQ
52 #error "The pw_unit_test framework backend must define EXPECT_EQ(lhs, rhs)"
53 #endif  // EXPECT_EQ
54 
55 #ifndef EXPECT_NE
56 #error "The pw_unit_test framework backend must define EXPECT_NE(lhs, rhs)"
57 #endif  // EXPECT_EQ
58 
59 #ifndef EXPECT_GT
60 #error "The pw_unit_test framework backend must define EXPECT_GT(lhs, rhs)"
61 #endif  // EXPECT_GT
62 
63 #ifndef EXPECT_GE
64 #error "The pw_unit_test framework backend must define EXPECT_GE(lhs, rhs)"
65 #endif  // EXPECT_GE
66 
67 #ifndef EXPECT_LT
68 #error "The pw_unit_test framework backend must define EXPECT_LT(lhs, rhs)"
69 #endif  // EXPECT_LT
70 
71 #ifndef EXPECT_LE
72 #error "The pw_unit_test framework backend must define EXPECT_LE(lhs, rhs)"
73 #endif  // EXPECT_LE
74 
75 #ifndef EXPECT_NEAR
76 #error \
77     "The pw_unit_test framework backend must define " \
78     "EXPECT_NEAR(lhs, rhs, epsilon)"
79 #endif  // EXPECT_NEAR
80 
81 #ifndef EXPECT_FLOAT_EQ
82 #error \
83     "The pw_unit_test framework backend must define EXPECT_FLOAT_EQ(lhs, rhs)"
84 #endif  // EXPECT_FLOAT_EQ
85 
86 #ifndef EXPECT_DOUBLE_EQ
87 #error \
88     "The pw_unit_test framework backend must define EXPECT_DOUBLE_EQ(lhs, rhs)"
89 #endif  // EXPECT_DOUBLE_EQ
90 
91 #ifndef EXPECT_STREQ
92 #error "The pw_unit_test framework backend must define EXPECT_STREQ(lhs, rhs)"
93 #endif  // EXPECT_STREQ
94 
95 #ifndef EXPECT_STRNE
96 #error "The pw_unit_test framework backend must define EXPECT_STRNE(lhs, rhs)"
97 #endif  // EXPECT_STRNE
98 
99 #ifndef ASSERT_TRUE
100 #error "The pw_unit_test framework backend must define ASSERT_TRUE(expr)"
101 #endif  // ASSERT_TRUE
102 
103 #ifndef ASSERT_FALSE
104 #error "The pw_unit_test framework backend must define ASSERT_FALSE(expr)"
105 #endif  // ASSERT_FALSE
106 
107 #ifndef ASSERT_EQ
108 #error "The pw_unit_test framework backend must define ASSERT_EQ(lhs, rhs)"
109 #endif  // ASSERT_EQ
110 
111 #ifndef ASSERT_NE
112 #error "The pw_unit_test framework backend must define ASSERT_NE(lhs, rhs)"
113 #endif  // ASSERT_NE
114 
115 #ifndef ASSERT_GT
116 #error "The pw_unit_test framework backend must define ASSERT_GT(lhs, rhs)"
117 #endif  // ASSERT_GT
118 
119 #ifndef ASSERT_GE
120 #error "The pw_unit_test framework backend must define ASSERT_GE(lhs, rhs)"
121 #endif  // ASSERT_GE
122 
123 #ifndef ASSERT_LT
124 #error "The pw_unit_test framework backend must define ASSERT_LT(lhs, rhs)"
125 #endif  // ASSERT_LT
126 
127 #ifndef ASSERT_LE
128 #error "The pw_unit_test framework backend must define ASSERT_LE(lhs, rhs)"
129 #endif  // ASSERT_LE
130 
131 #ifndef ASSERT_NEAR
132 #error \
133     "The pw_unit_test framework backend must define "\
134     "ASSERT_NEAR(lhs, rhs, epsilon)"
135 #endif  // ASSERT_NEAR
136 
137 #ifndef ASSERT_FLOAT_EQ
138 #error \
139     "The pw_unit_test framework backend must define ASSERT_FLOAT_EQ(lhs, rhs)"
140 #endif  // ASSERT_FLOAT_EQ
141 
142 #ifndef ASSERT_DOUBLE_EQ
143 #error \
144     "The pw_unit_test framework backend must define ASSERT_DOUBLE_EQ(lhs, rhs)"
145 #endif  // ASSERT_DOUBLE_EQ
146 
147 #ifndef ASSERT_STREQ
148 #error "The pw_unit_test framework backend must define ASSERT_STREQ(lhs, rhs)"
149 #endif  // ASSERT_STREQ
150 
151 #ifndef ASSERT_STRNE
152 #error "The pw_unit_test framework backend must define ASSERT_STRNE(lhs, rhs)"
153 #endif  // ASSERT_STRNE
154 
155 #ifndef ADD_FAILURE
156 #error "The pw_unit_test framework backend must define ADD_FAILURE()"
157 #endif  // ADD_FAILURE
158 
159 #ifndef GTEST_FAIL
160 #error "The pw_unit_test framework backend must define GTEST_FAIL()"
161 #endif  // GTEST_FAIL
162 
163 #ifndef GTEST_SKIP
164 #error "The pw_unit_test framework backend must define GTEST_SKIP()"
165 #endif  // GTEST_SKIP
166 
167 #ifndef FAIL
168 #error "The pw_unit_test framework backend must define FAIL()"
169 #endif  // FAIL
170 
171 #ifndef GTEST_SUCCEED
172 #error "The pw_unit_test framework backend must define GTEST_SUCCEED()"
173 #endif  // GTEST_SUCCEED
174 
175 #ifndef SUCCEED
176 #error "The pw_unit_test framework backend must define SUCCEED()"
177 #endif  // SUCCEED
178 
179 // RUN_ALL_TESTS can be a macro or a function, check for both.
180 #ifndef RUN_ALL_TESTS
181 static_assert(&RUN_ALL_TESTS != nullptr,
182               "The pw_unit_test framework backend must define RUN_ALL_TESTS()");
183 #endif  // RUN_ALL_TESTS
184 
185 #ifndef GTEST_HAS_DEATH_TEST
186 #error "The pw_unit_test framework backend must define GTEST_HAS_DEATH_TEST"
187 #endif  // GTEST_HAS_DEATH_TEST
188 
189 #ifndef EXPECT_DEATH_IF_SUPPORTED
190 #error \
191     "The pw_unit_test framework backend must define "\
192     "EXPECT_DEATH_IF_SUPPORTED(statement, regex)"
193 #endif  // EXPECT_DEATH_IF_SUPPORTED
194 
195 #ifndef ASSERT_DEATH_IF_SUPPORTED
196 #error \
197     "The pw_unit_test framework backend must define " \
198     "ASSERT_DEATH_IF_SUPPORTED(statement, regex)"
199 #endif  // ASSERT_DEATH_IF_SUPPORTED
200