Add support of 18-member structs to gmock UnpackStructImpl.

PiperOrigin-RevId: 463961734
Change-Id: Ib62e320a745c190955f181c1f4f12e4cd407ef22
pull/3966/head
Abseil Team 3 years ago committed by Copybara-Service
parent 3bc8fb3723
commit dd7a9d29a3
  1. 5
      googlemock/include/gmock/gmock-matchers.h
  2. 10
      googlemock/test/gmock-matchers-comparisons_test.cc

@ -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>

@ -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…
Cancel
Save