Skip to content

Commit 3f58c73

Browse files
committed
Fix CombineAsTest/CopyConstructible test
1 parent 183f8f2 commit 3f58c73

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

googletest/test/googletest-param-test-test.cc

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -633,22 +633,27 @@ TEST(CombineAsTest, NonDefaultConstructible) {
633633
}
634634

635635
TEST(CombineAsTest, CopyConstructible) {
636-
struct CopyConstructible {
636+
class CopyConstructible {
637+
public:
637638
CopyConstructible(const CopyConstructible& other) = default;
638639

640+
CopyConstructible(const int i_arg, std::string s_arg)
641+
: i_(i_arg), s_(std::move(s_arg)) {}
642+
639643
bool operator==(const CopyConstructible& other) const {
640-
return x == other.x && s == other.s;
644+
return i_ == other.i_ && s_ == other.s_;
641645
}
642646

643-
int x;
644-
std::string s;
647+
private:
648+
int i_;
649+
std::string s_;
645650
};
646651

647652
static_assert(std::is_copy_constructible_v<CopyConstructible>);
648653
ParamGenerator<CopyConstructible> gen = testing::CombineAs<CopyConstructible>(
649-
Values(CopyConstructible{0, "A"}, CopyConstructible{1, "B"}));
650-
CopyConstructible expected_values[] = {CopyConstructible{0, "A"},
651-
CopyConstructible{1, "B"}};
654+
Values(CopyConstructible(0, "A"), CopyConstructible(1, "B")));
655+
CopyConstructible expected_values[] = {CopyConstructible(0, "A"),
656+
CopyConstructible(1, "B")};
652657
VerifyGenerator(gen, expected_values);
653658
}
654659

0 commit comments

Comments
 (0)