mirror of
https://github.com/google/googletest.git
synced 2024-12-26 17:41:03 +08:00
Add support of 18-member structs to gmock UnpackStructImpl.
PiperOrigin-RevId: 463961734 Change-Id: Ib62e320a745c190955f181c1f4f12e4cd407ef22
This commit is contained in:
parent
3bc8fb3723
commit
dd7a9d29a3
@ -3240,6 +3240,11 @@ auto UnpackStructImpl(const T& t, MakeIndexSequence<17>, char) {
|
||||
const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q] = t;
|
||||
return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q);
|
||||
}
|
||||
template <typename T>
|
||||
auto UnpackStructImpl(const T& t, MakeIndexSequence<18>, char) {
|
||||
const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r] = t;
|
||||
return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r);
|
||||
}
|
||||
#endif // defined(__cpp_structured_bindings)
|
||||
|
||||
template <size_t I, typename T>
|
||||
@ -3306,8 +3311,8 @@ class FieldsAreMatcherImpl<Struct, IndexSequence<I...>>
|
||||
std::vector<StringMatchResultListener> inner_listener(sizeof...(I));
|
||||
|
||||
VariadicExpand(
|
||||
{failed_pos == ~size_t{} && !std::get<I>(matchers_).MatchAndExplain(
|
||||
std::get<I>(tuple), &inner_listener[I])
|
||||
{failed_pos == ~size_t{}&& !std::get<I>(matchers_).MatchAndExplain(
|
||||
std::get<I>(tuple), &inner_listener[I])
|
||||
? failed_pos = I
|
||||
: 0 ...});
|
||||
if (failed_pos != ~size_t{}) {
|
||||
|
@ -1710,6 +1710,16 @@ TEST(FieldsAreTest, StructuredBindings) {
|
||||
};
|
||||
EXPECT_THAT(MyVarType16{},
|
||||
FieldsAre(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
|
||||
struct MyVarType17 {
|
||||
int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q;
|
||||
};
|
||||
EXPECT_THAT(MyVarType17{},
|
||||
FieldsAre(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
|
||||
struct MyVarType18 {
|
||||
int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r;
|
||||
};
|
||||
EXPECT_THAT(MyVarType18{},
|
||||
FieldsAre(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user