mirror of
https://github.com/google/googletest.git
synced 2024-12-27 10:11:03 +08:00
Add support of 19-member structs to gmock UnpackStructImpl.
PiperOrigin-RevId: 469171380 Change-Id: Ic75fc0523924e40e620552d4c04b79dad22a68e0
This commit is contained in:
parent
c0e032efe5
commit
25cc5777a1
@ -3245,6 +3245,11 @@ 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;
|
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);
|
return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r);
|
||||||
}
|
}
|
||||||
|
template <typename T>
|
||||||
|
auto UnpackStructImpl(const T& t, MakeIndexSequence<19>, char) {
|
||||||
|
const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s] = t;
|
||||||
|
return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s);
|
||||||
|
}
|
||||||
#endif // defined(__cpp_structured_bindings)
|
#endif // defined(__cpp_structured_bindings)
|
||||||
|
|
||||||
template <size_t I, typename T>
|
template <size_t I, typename T>
|
||||||
|
@ -1720,6 +1720,11 @@ TEST(FieldsAreTest, StructuredBindings) {
|
|||||||
};
|
};
|
||||||
EXPECT_THAT(MyVarType18{},
|
EXPECT_THAT(MyVarType18{},
|
||||||
FieldsAre(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
|
FieldsAre(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
|
||||||
|
struct MyVarType19 {
|
||||||
|
int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s;
|
||||||
|
};
|
||||||
|
EXPECT_THAT(MyVarType19{}, FieldsAre(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user