explodethosebits 0.3.0__cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- etb/__init__.py +351 -0
- etb/__init__.pyi +976 -0
- etb/_etb.cpython-39-x86_64-linux-gnu.so +0 -0
- etb/_version.py +34 -0
- etb/py.typed +2 -0
- explodethosebits-0.3.0.dist-info/METADATA +405 -0
- explodethosebits-0.3.0.dist-info/RECORD +88 -0
- explodethosebits-0.3.0.dist-info/WHEEL +6 -0
- explodethosebits-0.3.0.dist-info/licenses/LICENSE +21 -0
- explodethosebits-0.3.0.dist-info/sboms/auditwheel.cdx.json +1 -0
- explodethosebits.libs/libcudart-c3a75b33.so.12.8.90 +0 -0
- include/etb/bit_coordinate.hpp +45 -0
- include/etb/bit_extraction.hpp +79 -0
- include/etb/bit_pruning.hpp +122 -0
- include/etb/config.hpp +284 -0
- include/etb/cuda/arch_optimizations.cuh +358 -0
- include/etb/cuda/blackwell_optimizations.cuh +300 -0
- include/etb/cuda/cuda_common.cuh +265 -0
- include/etb/cuda/etb_cuda.cuh +200 -0
- include/etb/cuda/gpu_memory.cuh +406 -0
- include/etb/cuda/heuristics_kernel.cuh +315 -0
- include/etb/cuda/path_generator_kernel.cuh +272 -0
- include/etb/cuda/prefix_pruner_kernel.cuh +370 -0
- include/etb/cuda/signature_kernel.cuh +328 -0
- include/etb/early_stopping.hpp +246 -0
- include/etb/etb.hpp +20 -0
- include/etb/heuristics.hpp +165 -0
- include/etb/memoization.hpp +285 -0
- include/etb/path.hpp +86 -0
- include/etb/path_count.hpp +87 -0
- include/etb/path_generator.hpp +175 -0
- include/etb/prefix_trie.hpp +339 -0
- include/etb/reporting.hpp +437 -0
- include/etb/scoring.hpp +269 -0
- include/etb/signature.hpp +190 -0
- include/gmock/gmock-actions.h +2297 -0
- include/gmock/gmock-cardinalities.h +159 -0
- include/gmock/gmock-function-mocker.h +518 -0
- include/gmock/gmock-matchers.h +5623 -0
- include/gmock/gmock-more-actions.h +658 -0
- include/gmock/gmock-more-matchers.h +120 -0
- include/gmock/gmock-nice-strict.h +277 -0
- include/gmock/gmock-spec-builders.h +2148 -0
- include/gmock/gmock.h +96 -0
- include/gmock/internal/custom/README.md +18 -0
- include/gmock/internal/custom/gmock-generated-actions.h +7 -0
- include/gmock/internal/custom/gmock-matchers.h +37 -0
- include/gmock/internal/custom/gmock-port.h +40 -0
- include/gmock/internal/gmock-internal-utils.h +487 -0
- include/gmock/internal/gmock-port.h +139 -0
- include/gmock/internal/gmock-pp.h +279 -0
- include/gtest/gtest-assertion-result.h +237 -0
- include/gtest/gtest-death-test.h +345 -0
- include/gtest/gtest-matchers.h +923 -0
- include/gtest/gtest-message.h +252 -0
- include/gtest/gtest-param-test.h +546 -0
- include/gtest/gtest-printers.h +1161 -0
- include/gtest/gtest-spi.h +250 -0
- include/gtest/gtest-test-part.h +192 -0
- include/gtest/gtest-typed-test.h +331 -0
- include/gtest/gtest.h +2321 -0
- include/gtest/gtest_pred_impl.h +279 -0
- include/gtest/gtest_prod.h +60 -0
- include/gtest/internal/custom/README.md +44 -0
- include/gtest/internal/custom/gtest-port.h +37 -0
- include/gtest/internal/custom/gtest-printers.h +42 -0
- include/gtest/internal/custom/gtest.h +37 -0
- include/gtest/internal/gtest-death-test-internal.h +307 -0
- include/gtest/internal/gtest-filepath.h +227 -0
- include/gtest/internal/gtest-internal.h +1560 -0
- include/gtest/internal/gtest-param-util.h +1026 -0
- include/gtest/internal/gtest-port-arch.h +122 -0
- include/gtest/internal/gtest-port.h +2481 -0
- include/gtest/internal/gtest-string.h +178 -0
- include/gtest/internal/gtest-type-util.h +220 -0
- lib/libetb_core.a +0 -0
- lib64/cmake/GTest/GTestConfig.cmake +33 -0
- lib64/cmake/GTest/GTestConfigVersion.cmake +43 -0
- lib64/cmake/GTest/GTestTargets-release.cmake +49 -0
- lib64/cmake/GTest/GTestTargets.cmake +139 -0
- lib64/libgmock.a +0 -0
- lib64/libgmock_main.a +0 -0
- lib64/libgtest.a +0 -0
- lib64/libgtest_main.a +0 -0
- lib64/pkgconfig/gmock.pc +10 -0
- lib64/pkgconfig/gmock_main.pc +10 -0
- lib64/pkgconfig/gtest.pc +9 -0
- lib64/pkgconfig/gtest_main.pc +10 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
#ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PP_H_
|
|
2
|
+
#define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PP_H_
|
|
3
|
+
|
|
4
|
+
// Expands and concatenates the arguments. Constructed macros reevaluate.
|
|
5
|
+
#define GMOCK_PP_CAT(_1, _2) GMOCK_PP_INTERNAL_CAT(_1, _2)
|
|
6
|
+
|
|
7
|
+
// Expands and stringifies the only argument.
|
|
8
|
+
#define GMOCK_PP_STRINGIZE(...) GMOCK_PP_INTERNAL_STRINGIZE(__VA_ARGS__)
|
|
9
|
+
|
|
10
|
+
// Returns empty. Given a variadic number of arguments.
|
|
11
|
+
#define GMOCK_PP_EMPTY(...)
|
|
12
|
+
|
|
13
|
+
// Returns a comma. Given a variadic number of arguments.
|
|
14
|
+
#define GMOCK_PP_COMMA(...) ,
|
|
15
|
+
|
|
16
|
+
// Returns the only argument.
|
|
17
|
+
#define GMOCK_PP_IDENTITY(_1) _1
|
|
18
|
+
|
|
19
|
+
// Evaluates to the number of arguments after expansion.
|
|
20
|
+
//
|
|
21
|
+
// #define PAIR x, y
|
|
22
|
+
//
|
|
23
|
+
// GMOCK_PP_NARG() => 1
|
|
24
|
+
// GMOCK_PP_NARG(x) => 1
|
|
25
|
+
// GMOCK_PP_NARG(x, y) => 2
|
|
26
|
+
// GMOCK_PP_NARG(PAIR) => 2
|
|
27
|
+
//
|
|
28
|
+
// Requires: the number of arguments after expansion is at most 15.
|
|
29
|
+
#define GMOCK_PP_NARG(...) \
|
|
30
|
+
GMOCK_PP_INTERNAL_16TH( \
|
|
31
|
+
(__VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0))
|
|
32
|
+
|
|
33
|
+
// Returns 1 if the expansion of arguments has an unprotected comma. Otherwise
|
|
34
|
+
// returns 0. Requires no more than 15 unprotected commas.
|
|
35
|
+
#define GMOCK_PP_HAS_COMMA(...) \
|
|
36
|
+
GMOCK_PP_INTERNAL_16TH( \
|
|
37
|
+
(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0))
|
|
38
|
+
|
|
39
|
+
// Returns the first argument.
|
|
40
|
+
#define GMOCK_PP_HEAD(...) GMOCK_PP_INTERNAL_HEAD((__VA_ARGS__, unusedArg))
|
|
41
|
+
|
|
42
|
+
// Returns the tail. A variadic list of all arguments minus the first. Requires
|
|
43
|
+
// at least one argument.
|
|
44
|
+
#define GMOCK_PP_TAIL(...) GMOCK_PP_INTERNAL_TAIL((__VA_ARGS__))
|
|
45
|
+
|
|
46
|
+
// Calls CAT(_Macro, NARG(__VA_ARGS__))(__VA_ARGS__)
|
|
47
|
+
#define GMOCK_PP_VARIADIC_CALL(_Macro, ...) \
|
|
48
|
+
GMOCK_PP_IDENTITY( \
|
|
49
|
+
GMOCK_PP_CAT(_Macro, GMOCK_PP_NARG(__VA_ARGS__))(__VA_ARGS__))
|
|
50
|
+
|
|
51
|
+
// If the arguments after expansion have no tokens, evaluates to `1`. Otherwise
|
|
52
|
+
// evaluates to `0`.
|
|
53
|
+
//
|
|
54
|
+
// Requires: * the number of arguments after expansion is at most 15.
|
|
55
|
+
// * If the argument is a macro, it must be able to be called with one
|
|
56
|
+
// argument.
|
|
57
|
+
//
|
|
58
|
+
// Implementation details:
|
|
59
|
+
//
|
|
60
|
+
// There is one case when it generates a compile error: if the argument is macro
|
|
61
|
+
// that cannot be called with one argument.
|
|
62
|
+
//
|
|
63
|
+
// #define M(a, b) // it doesn't matter what it expands to
|
|
64
|
+
//
|
|
65
|
+
// // Expected: expands to `0`.
|
|
66
|
+
// // Actual: compile error.
|
|
67
|
+
// GMOCK_PP_IS_EMPTY(M)
|
|
68
|
+
//
|
|
69
|
+
// There are 4 cases tested:
|
|
70
|
+
//
|
|
71
|
+
// * __VA_ARGS__ possible expansion has no unparen'd commas. Expected 0.
|
|
72
|
+
// * __VA_ARGS__ possible expansion is not enclosed in parenthesis. Expected 0.
|
|
73
|
+
// * __VA_ARGS__ possible expansion is not a macro that ()-evaluates to a comma.
|
|
74
|
+
// Expected 0
|
|
75
|
+
// * __VA_ARGS__ is empty, or has unparen'd commas, or is enclosed in
|
|
76
|
+
// parenthesis, or is a macro that ()-evaluates to comma. Expected 1.
|
|
77
|
+
//
|
|
78
|
+
// We trigger detection on '0001', i.e. on empty.
|
|
79
|
+
#define GMOCK_PP_IS_EMPTY(...) \
|
|
80
|
+
GMOCK_PP_INTERNAL_IS_EMPTY(GMOCK_PP_HAS_COMMA(__VA_ARGS__), \
|
|
81
|
+
GMOCK_PP_HAS_COMMA(GMOCK_PP_COMMA __VA_ARGS__), \
|
|
82
|
+
GMOCK_PP_HAS_COMMA(__VA_ARGS__()), \
|
|
83
|
+
GMOCK_PP_HAS_COMMA(GMOCK_PP_COMMA __VA_ARGS__()))
|
|
84
|
+
|
|
85
|
+
// Evaluates to _Then if _Cond is 1 and _Else if _Cond is 0.
|
|
86
|
+
#define GMOCK_PP_IF(_Cond, _Then, _Else) \
|
|
87
|
+
GMOCK_PP_CAT(GMOCK_PP_INTERNAL_IF_, _Cond)(_Then, _Else)
|
|
88
|
+
|
|
89
|
+
// Similar to GMOCK_PP_IF but takes _Then and _Else in parentheses.
|
|
90
|
+
//
|
|
91
|
+
// GMOCK_PP_GENERIC_IF(1, (a, b, c), (d, e, f)) => a, b, c
|
|
92
|
+
// GMOCK_PP_GENERIC_IF(0, (a, b, c), (d, e, f)) => d, e, f
|
|
93
|
+
//
|
|
94
|
+
#define GMOCK_PP_GENERIC_IF(_Cond, _Then, _Else) \
|
|
95
|
+
GMOCK_PP_REMOVE_PARENS(GMOCK_PP_IF(_Cond, _Then, _Else))
|
|
96
|
+
|
|
97
|
+
// Evaluates to the number of arguments after expansion. Identifies 'empty' as
|
|
98
|
+
// 0.
|
|
99
|
+
//
|
|
100
|
+
// #define PAIR x, y
|
|
101
|
+
//
|
|
102
|
+
// GMOCK_PP_NARG0() => 0
|
|
103
|
+
// GMOCK_PP_NARG0(x) => 1
|
|
104
|
+
// GMOCK_PP_NARG0(x, y) => 2
|
|
105
|
+
// GMOCK_PP_NARG0(PAIR) => 2
|
|
106
|
+
//
|
|
107
|
+
// Requires: * the number of arguments after expansion is at most 15.
|
|
108
|
+
// * If the argument is a macro, it must be able to be called with one
|
|
109
|
+
// argument.
|
|
110
|
+
#define GMOCK_PP_NARG0(...) \
|
|
111
|
+
GMOCK_PP_IF(GMOCK_PP_IS_EMPTY(__VA_ARGS__), 0, GMOCK_PP_NARG(__VA_ARGS__))
|
|
112
|
+
|
|
113
|
+
// Expands to 1 if the first argument starts with something in parentheses,
|
|
114
|
+
// otherwise to 0.
|
|
115
|
+
#define GMOCK_PP_IS_BEGIN_PARENS(...) \
|
|
116
|
+
GMOCK_PP_HEAD(GMOCK_PP_CAT(GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_, \
|
|
117
|
+
GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_C __VA_ARGS__))
|
|
118
|
+
|
|
119
|
+
// Expands to 1 is there is only one argument and it is enclosed in parentheses.
|
|
120
|
+
#define GMOCK_PP_IS_ENCLOSED_PARENS(...) \
|
|
121
|
+
GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(__VA_ARGS__), \
|
|
122
|
+
GMOCK_PP_IS_EMPTY(GMOCK_PP_EMPTY __VA_ARGS__), 0)
|
|
123
|
+
|
|
124
|
+
// Remove the parens, requires GMOCK_PP_IS_ENCLOSED_PARENS(args) => 1.
|
|
125
|
+
#define GMOCK_PP_REMOVE_PARENS(...) GMOCK_PP_INTERNAL_REMOVE_PARENS __VA_ARGS__
|
|
126
|
+
|
|
127
|
+
// Expands to _Macro(0, _Data, e1) _Macro(1, _Data, e2) ... _Macro(K -1, _Data,
|
|
128
|
+
// eK) as many of GMOCK_INTERNAL_NARG0 _Tuple.
|
|
129
|
+
// Requires: * |_Macro| can be called with 3 arguments.
|
|
130
|
+
// * |_Tuple| expansion has no more than 15 elements.
|
|
131
|
+
#define GMOCK_PP_FOR_EACH(_Macro, _Data, _Tuple) \
|
|
132
|
+
GMOCK_PP_CAT(GMOCK_PP_INTERNAL_FOR_EACH_IMPL_, GMOCK_PP_NARG0 _Tuple) \
|
|
133
|
+
(0, _Macro, _Data, _Tuple)
|
|
134
|
+
|
|
135
|
+
// Expands to _Macro(0, _Data, ) _Macro(1, _Data, ) ... _Macro(K - 1, _Data, )
|
|
136
|
+
// Empty if _K = 0.
|
|
137
|
+
// Requires: * |_Macro| can be called with 3 arguments.
|
|
138
|
+
// * |_K| literal between 0 and 15
|
|
139
|
+
#define GMOCK_PP_REPEAT(_Macro, _Data, _N) \
|
|
140
|
+
GMOCK_PP_CAT(GMOCK_PP_INTERNAL_FOR_EACH_IMPL_, _N) \
|
|
141
|
+
(0, _Macro, _Data, GMOCK_PP_INTENRAL_EMPTY_TUPLE)
|
|
142
|
+
|
|
143
|
+
// Increments the argument, requires the argument to be between 0 and 15.
|
|
144
|
+
#define GMOCK_PP_INC(_i) GMOCK_PP_CAT(GMOCK_PP_INTERNAL_INC_, _i)
|
|
145
|
+
|
|
146
|
+
// Returns comma if _i != 0. Requires _i to be between 0 and 15.
|
|
147
|
+
#define GMOCK_PP_COMMA_IF(_i) GMOCK_PP_CAT(GMOCK_PP_INTERNAL_COMMA_IF_, _i)
|
|
148
|
+
|
|
149
|
+
// Internal details follow. Do not use any of these symbols outside of this
|
|
150
|
+
// file or we will break your code.
|
|
151
|
+
#define GMOCK_PP_INTENRAL_EMPTY_TUPLE (, , , , , , , , , , , , , , , )
|
|
152
|
+
#define GMOCK_PP_INTERNAL_CAT(_1, _2) _1##_2
|
|
153
|
+
#define GMOCK_PP_INTERNAL_STRINGIZE(...) #__VA_ARGS__
|
|
154
|
+
#define GMOCK_PP_INTERNAL_CAT_5(_1, _2, _3, _4, _5) _1##_2##_3##_4##_5
|
|
155
|
+
#define GMOCK_PP_INTERNAL_IS_EMPTY(_1, _2, _3, _4) \
|
|
156
|
+
GMOCK_PP_HAS_COMMA(GMOCK_PP_INTERNAL_CAT_5(GMOCK_PP_INTERNAL_IS_EMPTY_CASE_, \
|
|
157
|
+
_1, _2, _3, _4))
|
|
158
|
+
#define GMOCK_PP_INTERNAL_IS_EMPTY_CASE_0001 ,
|
|
159
|
+
#define GMOCK_PP_INTERNAL_IF_1(_Then, _Else) _Then
|
|
160
|
+
#define GMOCK_PP_INTERNAL_IF_0(_Then, _Else) _Else
|
|
161
|
+
|
|
162
|
+
// Because of MSVC treating a token with a comma in it as a single token when
|
|
163
|
+
// passed to another macro, we need to force it to evaluate it as multiple
|
|
164
|
+
// tokens. We do that by using a "IDENTITY(MACRO PARENTHESIZED_ARGS)" macro. We
|
|
165
|
+
// define one per possible macro that relies on this behavior. Note "_Args" must
|
|
166
|
+
// be parenthesized.
|
|
167
|
+
#define GMOCK_PP_INTERNAL_INTERNAL_16TH(_1, _2, _3, _4, _5, _6, _7, _8, _9, \
|
|
168
|
+
_10, _11, _12, _13, _14, _15, _16, \
|
|
169
|
+
...) \
|
|
170
|
+
_16
|
|
171
|
+
#define GMOCK_PP_INTERNAL_16TH(_Args) \
|
|
172
|
+
GMOCK_PP_IDENTITY(GMOCK_PP_INTERNAL_INTERNAL_16TH _Args)
|
|
173
|
+
#define GMOCK_PP_INTERNAL_INTERNAL_HEAD(_1, ...) _1
|
|
174
|
+
#define GMOCK_PP_INTERNAL_HEAD(_Args) \
|
|
175
|
+
GMOCK_PP_IDENTITY(GMOCK_PP_INTERNAL_INTERNAL_HEAD _Args)
|
|
176
|
+
#define GMOCK_PP_INTERNAL_INTERNAL_TAIL(_1, ...) __VA_ARGS__
|
|
177
|
+
#define GMOCK_PP_INTERNAL_TAIL(_Args) \
|
|
178
|
+
GMOCK_PP_IDENTITY(GMOCK_PP_INTERNAL_INTERNAL_TAIL _Args)
|
|
179
|
+
|
|
180
|
+
#define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_C(...) 1 _
|
|
181
|
+
#define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_1 1,
|
|
182
|
+
#define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_C \
|
|
183
|
+
0,
|
|
184
|
+
#define GMOCK_PP_INTERNAL_REMOVE_PARENS(...) __VA_ARGS__
|
|
185
|
+
#define GMOCK_PP_INTERNAL_INC_0 1
|
|
186
|
+
#define GMOCK_PP_INTERNAL_INC_1 2
|
|
187
|
+
#define GMOCK_PP_INTERNAL_INC_2 3
|
|
188
|
+
#define GMOCK_PP_INTERNAL_INC_3 4
|
|
189
|
+
#define GMOCK_PP_INTERNAL_INC_4 5
|
|
190
|
+
#define GMOCK_PP_INTERNAL_INC_5 6
|
|
191
|
+
#define GMOCK_PP_INTERNAL_INC_6 7
|
|
192
|
+
#define GMOCK_PP_INTERNAL_INC_7 8
|
|
193
|
+
#define GMOCK_PP_INTERNAL_INC_8 9
|
|
194
|
+
#define GMOCK_PP_INTERNAL_INC_9 10
|
|
195
|
+
#define GMOCK_PP_INTERNAL_INC_10 11
|
|
196
|
+
#define GMOCK_PP_INTERNAL_INC_11 12
|
|
197
|
+
#define GMOCK_PP_INTERNAL_INC_12 13
|
|
198
|
+
#define GMOCK_PP_INTERNAL_INC_13 14
|
|
199
|
+
#define GMOCK_PP_INTERNAL_INC_14 15
|
|
200
|
+
#define GMOCK_PP_INTERNAL_INC_15 16
|
|
201
|
+
#define GMOCK_PP_INTERNAL_COMMA_IF_0
|
|
202
|
+
#define GMOCK_PP_INTERNAL_COMMA_IF_1 ,
|
|
203
|
+
#define GMOCK_PP_INTERNAL_COMMA_IF_2 ,
|
|
204
|
+
#define GMOCK_PP_INTERNAL_COMMA_IF_3 ,
|
|
205
|
+
#define GMOCK_PP_INTERNAL_COMMA_IF_4 ,
|
|
206
|
+
#define GMOCK_PP_INTERNAL_COMMA_IF_5 ,
|
|
207
|
+
#define GMOCK_PP_INTERNAL_COMMA_IF_6 ,
|
|
208
|
+
#define GMOCK_PP_INTERNAL_COMMA_IF_7 ,
|
|
209
|
+
#define GMOCK_PP_INTERNAL_COMMA_IF_8 ,
|
|
210
|
+
#define GMOCK_PP_INTERNAL_COMMA_IF_9 ,
|
|
211
|
+
#define GMOCK_PP_INTERNAL_COMMA_IF_10 ,
|
|
212
|
+
#define GMOCK_PP_INTERNAL_COMMA_IF_11 ,
|
|
213
|
+
#define GMOCK_PP_INTERNAL_COMMA_IF_12 ,
|
|
214
|
+
#define GMOCK_PP_INTERNAL_COMMA_IF_13 ,
|
|
215
|
+
#define GMOCK_PP_INTERNAL_COMMA_IF_14 ,
|
|
216
|
+
#define GMOCK_PP_INTERNAL_COMMA_IF_15 ,
|
|
217
|
+
#define GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, _element) \
|
|
218
|
+
_Macro(_i, _Data, _element)
|
|
219
|
+
#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_0(_i, _Macro, _Data, _Tuple)
|
|
220
|
+
#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_1(_i, _Macro, _Data, _Tuple) \
|
|
221
|
+
GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple)
|
|
222
|
+
#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_2(_i, _Macro, _Data, _Tuple) \
|
|
223
|
+
GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \
|
|
224
|
+
GMOCK_PP_INTERNAL_FOR_EACH_IMPL_1(GMOCK_PP_INC(_i), _Macro, _Data, \
|
|
225
|
+
(GMOCK_PP_TAIL _Tuple))
|
|
226
|
+
#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_3(_i, _Macro, _Data, _Tuple) \
|
|
227
|
+
GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \
|
|
228
|
+
GMOCK_PP_INTERNAL_FOR_EACH_IMPL_2(GMOCK_PP_INC(_i), _Macro, _Data, \
|
|
229
|
+
(GMOCK_PP_TAIL _Tuple))
|
|
230
|
+
#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_4(_i, _Macro, _Data, _Tuple) \
|
|
231
|
+
GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \
|
|
232
|
+
GMOCK_PP_INTERNAL_FOR_EACH_IMPL_3(GMOCK_PP_INC(_i), _Macro, _Data, \
|
|
233
|
+
(GMOCK_PP_TAIL _Tuple))
|
|
234
|
+
#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_5(_i, _Macro, _Data, _Tuple) \
|
|
235
|
+
GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \
|
|
236
|
+
GMOCK_PP_INTERNAL_FOR_EACH_IMPL_4(GMOCK_PP_INC(_i), _Macro, _Data, \
|
|
237
|
+
(GMOCK_PP_TAIL _Tuple))
|
|
238
|
+
#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_6(_i, _Macro, _Data, _Tuple) \
|
|
239
|
+
GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \
|
|
240
|
+
GMOCK_PP_INTERNAL_FOR_EACH_IMPL_5(GMOCK_PP_INC(_i), _Macro, _Data, \
|
|
241
|
+
(GMOCK_PP_TAIL _Tuple))
|
|
242
|
+
#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_7(_i, _Macro, _Data, _Tuple) \
|
|
243
|
+
GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \
|
|
244
|
+
GMOCK_PP_INTERNAL_FOR_EACH_IMPL_6(GMOCK_PP_INC(_i), _Macro, _Data, \
|
|
245
|
+
(GMOCK_PP_TAIL _Tuple))
|
|
246
|
+
#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_8(_i, _Macro, _Data, _Tuple) \
|
|
247
|
+
GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \
|
|
248
|
+
GMOCK_PP_INTERNAL_FOR_EACH_IMPL_7(GMOCK_PP_INC(_i), _Macro, _Data, \
|
|
249
|
+
(GMOCK_PP_TAIL _Tuple))
|
|
250
|
+
#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_9(_i, _Macro, _Data, _Tuple) \
|
|
251
|
+
GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \
|
|
252
|
+
GMOCK_PP_INTERNAL_FOR_EACH_IMPL_8(GMOCK_PP_INC(_i), _Macro, _Data, \
|
|
253
|
+
(GMOCK_PP_TAIL _Tuple))
|
|
254
|
+
#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_10(_i, _Macro, _Data, _Tuple) \
|
|
255
|
+
GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \
|
|
256
|
+
GMOCK_PP_INTERNAL_FOR_EACH_IMPL_9(GMOCK_PP_INC(_i), _Macro, _Data, \
|
|
257
|
+
(GMOCK_PP_TAIL _Tuple))
|
|
258
|
+
#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_11(_i, _Macro, _Data, _Tuple) \
|
|
259
|
+
GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \
|
|
260
|
+
GMOCK_PP_INTERNAL_FOR_EACH_IMPL_10(GMOCK_PP_INC(_i), _Macro, _Data, \
|
|
261
|
+
(GMOCK_PP_TAIL _Tuple))
|
|
262
|
+
#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_12(_i, _Macro, _Data, _Tuple) \
|
|
263
|
+
GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \
|
|
264
|
+
GMOCK_PP_INTERNAL_FOR_EACH_IMPL_11(GMOCK_PP_INC(_i), _Macro, _Data, \
|
|
265
|
+
(GMOCK_PP_TAIL _Tuple))
|
|
266
|
+
#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_13(_i, _Macro, _Data, _Tuple) \
|
|
267
|
+
GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \
|
|
268
|
+
GMOCK_PP_INTERNAL_FOR_EACH_IMPL_12(GMOCK_PP_INC(_i), _Macro, _Data, \
|
|
269
|
+
(GMOCK_PP_TAIL _Tuple))
|
|
270
|
+
#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_14(_i, _Macro, _Data, _Tuple) \
|
|
271
|
+
GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \
|
|
272
|
+
GMOCK_PP_INTERNAL_FOR_EACH_IMPL_13(GMOCK_PP_INC(_i), _Macro, _Data, \
|
|
273
|
+
(GMOCK_PP_TAIL _Tuple))
|
|
274
|
+
#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_15(_i, _Macro, _Data, _Tuple) \
|
|
275
|
+
GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \
|
|
276
|
+
GMOCK_PP_INTERNAL_FOR_EACH_IMPL_14(GMOCK_PP_INC(_i), _Macro, _Data, \
|
|
277
|
+
(GMOCK_PP_TAIL _Tuple))
|
|
278
|
+
|
|
279
|
+
#endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PP_H_
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
// Copyright 2005, Google Inc.
|
|
2
|
+
// All rights reserved.
|
|
3
|
+
//
|
|
4
|
+
// Redistribution and use in source and binary forms, with or without
|
|
5
|
+
// modification, are permitted provided that the following conditions are
|
|
6
|
+
// met:
|
|
7
|
+
//
|
|
8
|
+
// * Redistributions of source code must retain the above copyright
|
|
9
|
+
// notice, this list of conditions and the following disclaimer.
|
|
10
|
+
// * Redistributions in binary form must reproduce the above
|
|
11
|
+
// copyright notice, this list of conditions and the following disclaimer
|
|
12
|
+
// in the documentation and/or other materials provided with the
|
|
13
|
+
// distribution.
|
|
14
|
+
// * Neither the name of Google Inc. nor the names of its
|
|
15
|
+
// contributors may be used to endorse or promote products derived from
|
|
16
|
+
// this software without specific prior written permission.
|
|
17
|
+
//
|
|
18
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
19
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
20
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
21
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
22
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
23
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
24
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
25
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
26
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
27
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
29
|
+
|
|
30
|
+
// The Google C++ Testing and Mocking Framework (Google Test)
|
|
31
|
+
//
|
|
32
|
+
// This file implements the AssertionResult type.
|
|
33
|
+
|
|
34
|
+
// IWYU pragma: private, include "gtest/gtest.h"
|
|
35
|
+
// IWYU pragma: friend gtest/.*
|
|
36
|
+
// IWYU pragma: friend gmock/.*
|
|
37
|
+
|
|
38
|
+
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_ASSERTION_RESULT_H_
|
|
39
|
+
#define GOOGLETEST_INCLUDE_GTEST_GTEST_ASSERTION_RESULT_H_
|
|
40
|
+
|
|
41
|
+
#include <memory>
|
|
42
|
+
#include <ostream>
|
|
43
|
+
#include <string>
|
|
44
|
+
#include <type_traits>
|
|
45
|
+
|
|
46
|
+
#include "gtest/gtest-message.h"
|
|
47
|
+
#include "gtest/internal/gtest-port.h"
|
|
48
|
+
|
|
49
|
+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
|
50
|
+
/* class A needs to have dll-interface to be used by clients of class B */)
|
|
51
|
+
|
|
52
|
+
namespace testing {
|
|
53
|
+
|
|
54
|
+
// A class for indicating whether an assertion was successful. When
|
|
55
|
+
// the assertion wasn't successful, the AssertionResult object
|
|
56
|
+
// remembers a non-empty message that describes how it failed.
|
|
57
|
+
//
|
|
58
|
+
// To create an instance of this class, use one of the factory functions
|
|
59
|
+
// (AssertionSuccess() and AssertionFailure()).
|
|
60
|
+
//
|
|
61
|
+
// This class is useful for two purposes:
|
|
62
|
+
// 1. Defining predicate functions to be used with Boolean test assertions
|
|
63
|
+
// EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
|
|
64
|
+
// 2. Defining predicate-format functions to be
|
|
65
|
+
// used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
|
|
66
|
+
//
|
|
67
|
+
// For example, if you define IsEven predicate:
|
|
68
|
+
//
|
|
69
|
+
// testing::AssertionResult IsEven(int n) {
|
|
70
|
+
// if ((n % 2) == 0)
|
|
71
|
+
// return testing::AssertionSuccess();
|
|
72
|
+
// else
|
|
73
|
+
// return testing::AssertionFailure() << n << " is odd";
|
|
74
|
+
// }
|
|
75
|
+
//
|
|
76
|
+
// Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
|
|
77
|
+
// will print the message
|
|
78
|
+
//
|
|
79
|
+
// Value of: IsEven(Fib(5))
|
|
80
|
+
// Actual: false (5 is odd)
|
|
81
|
+
// Expected: true
|
|
82
|
+
//
|
|
83
|
+
// instead of a more opaque
|
|
84
|
+
//
|
|
85
|
+
// Value of: IsEven(Fib(5))
|
|
86
|
+
// Actual: false
|
|
87
|
+
// Expected: true
|
|
88
|
+
//
|
|
89
|
+
// in case IsEven is a simple Boolean predicate.
|
|
90
|
+
//
|
|
91
|
+
// If you expect your predicate to be reused and want to support informative
|
|
92
|
+
// messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
|
|
93
|
+
// about half as often as positive ones in our tests), supply messages for
|
|
94
|
+
// both success and failure cases:
|
|
95
|
+
//
|
|
96
|
+
// testing::AssertionResult IsEven(int n) {
|
|
97
|
+
// if ((n % 2) == 0)
|
|
98
|
+
// return testing::AssertionSuccess() << n << " is even";
|
|
99
|
+
// else
|
|
100
|
+
// return testing::AssertionFailure() << n << " is odd";
|
|
101
|
+
// }
|
|
102
|
+
//
|
|
103
|
+
// Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
|
|
104
|
+
//
|
|
105
|
+
// Value of: IsEven(Fib(6))
|
|
106
|
+
// Actual: true (8 is even)
|
|
107
|
+
// Expected: false
|
|
108
|
+
//
|
|
109
|
+
// NB: Predicates that support negative Boolean assertions have reduced
|
|
110
|
+
// performance in positive ones so be careful not to use them in tests
|
|
111
|
+
// that have lots (tens of thousands) of positive Boolean assertions.
|
|
112
|
+
//
|
|
113
|
+
// To use this class with EXPECT_PRED_FORMAT assertions such as:
|
|
114
|
+
//
|
|
115
|
+
// // Verifies that Foo() returns an even number.
|
|
116
|
+
// EXPECT_PRED_FORMAT1(IsEven, Foo());
|
|
117
|
+
//
|
|
118
|
+
// you need to define:
|
|
119
|
+
//
|
|
120
|
+
// testing::AssertionResult IsEven(const char* expr, int n) {
|
|
121
|
+
// if ((n % 2) == 0)
|
|
122
|
+
// return testing::AssertionSuccess();
|
|
123
|
+
// else
|
|
124
|
+
// return testing::AssertionFailure()
|
|
125
|
+
// << "Expected: " << expr << " is even\n Actual: it's " << n;
|
|
126
|
+
// }
|
|
127
|
+
//
|
|
128
|
+
// If Foo() returns 5, you will see the following message:
|
|
129
|
+
//
|
|
130
|
+
// Expected: Foo() is even
|
|
131
|
+
// Actual: it's 5
|
|
132
|
+
//
|
|
133
|
+
class GTEST_API_ AssertionResult {
|
|
134
|
+
public:
|
|
135
|
+
// Copy constructor.
|
|
136
|
+
// Used in EXPECT_TRUE/FALSE(assertion_result).
|
|
137
|
+
AssertionResult(const AssertionResult& other);
|
|
138
|
+
|
|
139
|
+
// C4800 is a level 3 warning in Visual Studio 2015 and earlier.
|
|
140
|
+
// This warning is not emitted in Visual Studio 2017.
|
|
141
|
+
// This warning is off by default starting in Visual Studio 2019 but can be
|
|
142
|
+
// enabled with command-line options.
|
|
143
|
+
#if defined(_MSC_VER) && (_MSC_VER < 1910 || _MSC_VER >= 1920)
|
|
144
|
+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
|
|
145
|
+
#endif
|
|
146
|
+
|
|
147
|
+
// Used in the EXPECT_TRUE/FALSE(bool_expression).
|
|
148
|
+
//
|
|
149
|
+
// T must be contextually convertible to bool.
|
|
150
|
+
//
|
|
151
|
+
// The second parameter prevents this overload from being considered if
|
|
152
|
+
// the argument is implicitly convertible to AssertionResult. In that case
|
|
153
|
+
// we want AssertionResult's copy constructor to be used.
|
|
154
|
+
template <typename T>
|
|
155
|
+
explicit AssertionResult(
|
|
156
|
+
const T& success,
|
|
157
|
+
typename std::enable_if<
|
|
158
|
+
!std::is_convertible<T, AssertionResult>::value>::type*
|
|
159
|
+
/*enabler*/
|
|
160
|
+
= nullptr)
|
|
161
|
+
: success_(success) {}
|
|
162
|
+
|
|
163
|
+
#if defined(_MSC_VER) && (_MSC_VER < 1910 || _MSC_VER >= 1920)
|
|
164
|
+
GTEST_DISABLE_MSC_WARNINGS_POP_()
|
|
165
|
+
#endif
|
|
166
|
+
|
|
167
|
+
// Assignment operator.
|
|
168
|
+
AssertionResult& operator=(AssertionResult other) {
|
|
169
|
+
swap(other);
|
|
170
|
+
return *this;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Returns true if and only if the assertion succeeded.
|
|
174
|
+
operator bool() const { return success_; } // NOLINT
|
|
175
|
+
|
|
176
|
+
// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
|
|
177
|
+
AssertionResult operator!() const;
|
|
178
|
+
|
|
179
|
+
// Returns the text streamed into this AssertionResult. Test assertions
|
|
180
|
+
// use it when they fail (i.e., the predicate's outcome doesn't match the
|
|
181
|
+
// assertion's expectation). When nothing has been streamed into the
|
|
182
|
+
// object, returns an empty string.
|
|
183
|
+
const char* message() const {
|
|
184
|
+
return message_ != nullptr ? message_->c_str() : "";
|
|
185
|
+
}
|
|
186
|
+
// Deprecated; please use message() instead.
|
|
187
|
+
const char* failure_message() const { return message(); }
|
|
188
|
+
|
|
189
|
+
// Streams a custom failure message into this object.
|
|
190
|
+
template <typename T>
|
|
191
|
+
AssertionResult& operator<<(const T& value) {
|
|
192
|
+
AppendMessage(Message() << value);
|
|
193
|
+
return *this;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Allows streaming basic output manipulators such as endl or flush into
|
|
197
|
+
// this object.
|
|
198
|
+
AssertionResult& operator<<(
|
|
199
|
+
::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
|
|
200
|
+
AppendMessage(Message() << basic_manipulator);
|
|
201
|
+
return *this;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
private:
|
|
205
|
+
// Appends the contents of message to message_.
|
|
206
|
+
void AppendMessage(const Message& a_message) {
|
|
207
|
+
if (message_ == nullptr) message_ = ::std::make_unique<::std::string>();
|
|
208
|
+
message_->append(a_message.GetString().c_str());
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Swap the contents of this AssertionResult with other.
|
|
212
|
+
void swap(AssertionResult& other);
|
|
213
|
+
|
|
214
|
+
// Stores result of the assertion predicate.
|
|
215
|
+
bool success_;
|
|
216
|
+
// Stores the message describing the condition in case the expectation
|
|
217
|
+
// construct is not satisfied with the predicate's outcome.
|
|
218
|
+
// Referenced via a pointer to avoid taking too much stack frame space
|
|
219
|
+
// with test assertions.
|
|
220
|
+
std::unique_ptr< ::std::string> message_;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// Makes a successful assertion result.
|
|
224
|
+
GTEST_API_ AssertionResult AssertionSuccess();
|
|
225
|
+
|
|
226
|
+
// Makes a failed assertion result.
|
|
227
|
+
GTEST_API_ AssertionResult AssertionFailure();
|
|
228
|
+
|
|
229
|
+
// Makes a failed assertion result with the given failure message.
|
|
230
|
+
// Deprecated; use AssertionFailure() << msg.
|
|
231
|
+
GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
|
|
232
|
+
|
|
233
|
+
} // namespace testing
|
|
234
|
+
|
|
235
|
+
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
|
236
|
+
|
|
237
|
+
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_ASSERTION_RESULT_H_
|