mirror of
https://github.com/google/googletest.git
synced 2025-12-06 16:57:00 +08:00
Automated Code Change
PiperOrigin-RevId: 820039898 Change-Id: I910d8ec41198794e7344a2d79566a19243532251
This commit is contained in:
parent
8dbd60f7d5
commit
e17e37a115
@ -1822,7 +1822,7 @@ std::vector<std::unique_ptr<int>> VectorUniquePtrSource() {
|
|||||||
|
|
||||||
TEST(MockMethodTest, CanReturnMoveOnlyValue_Return) {
|
TEST(MockMethodTest, CanReturnMoveOnlyValue_Return) {
|
||||||
MockClass mock;
|
MockClass mock;
|
||||||
std::unique_ptr<int> i(new int(19));
|
std::unique_ptr<int> i = std::make_unique<int>(19);
|
||||||
EXPECT_CALL(mock, MakeUnique()).WillOnce(Return(ByMove(std::move(i))));
|
EXPECT_CALL(mock, MakeUnique()).WillOnce(Return(ByMove(std::move(i))));
|
||||||
EXPECT_CALL(mock, MakeVectorUnique())
|
EXPECT_CALL(mock, MakeVectorUnique())
|
||||||
.WillOnce(Return(ByMove(VectorUniquePtrSource())));
|
.WillOnce(Return(ByMove(VectorUniquePtrSource())));
|
||||||
@ -1845,7 +1845,7 @@ TEST(MockMethodTest, CanReturnMoveOnlyValue_Return) {
|
|||||||
TEST(MockMethodTest, CanReturnMoveOnlyValue_DoAllReturn) {
|
TEST(MockMethodTest, CanReturnMoveOnlyValue_DoAllReturn) {
|
||||||
testing::MockFunction<void()> mock_function;
|
testing::MockFunction<void()> mock_function;
|
||||||
MockClass mock;
|
MockClass mock;
|
||||||
std::unique_ptr<int> i(new int(19));
|
std::unique_ptr<int> i = std::make_unique<int>(19);
|
||||||
EXPECT_CALL(mock_function, Call());
|
EXPECT_CALL(mock_function, Call());
|
||||||
EXPECT_CALL(mock, MakeUnique())
|
EXPECT_CALL(mock, MakeUnique())
|
||||||
.WillOnce(DoAll(InvokeWithoutArgs(&mock_function,
|
.WillOnce(DoAll(InvokeWithoutArgs(&mock_function,
|
||||||
|
|||||||
@ -1625,7 +1625,7 @@ TEST_F(DoubleNearTest, NanSensitiveDoubleNearCanMatchNaN) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(NotTest, WorksOnMoveOnlyType) {
|
TEST(NotTest, WorksOnMoveOnlyType) {
|
||||||
std::unique_ptr<int> p(new int(3));
|
std::unique_ptr<int> p = std::make_unique<int>(3);
|
||||||
EXPECT_THAT(p, Pointee(Eq(3)));
|
EXPECT_THAT(p, Pointee(Eq(3)));
|
||||||
EXPECT_THAT(p, Not(Pointee(Eq(2))));
|
EXPECT_THAT(p, Not(Pointee(Eq(2))));
|
||||||
}
|
}
|
||||||
@ -1681,13 +1681,13 @@ TEST(AnyOfTest, DoesNotCallAnyOfUnqualified) {
|
|||||||
} // namespace adl_test
|
} // namespace adl_test
|
||||||
|
|
||||||
TEST(AllOfTest, WorksOnMoveOnlyType) {
|
TEST(AllOfTest, WorksOnMoveOnlyType) {
|
||||||
std::unique_ptr<int> p(new int(3));
|
std::unique_ptr<int> p = std::make_unique<int>(3);
|
||||||
EXPECT_THAT(p, AllOf(Pointee(Eq(3)), Pointee(Gt(0)), Pointee(Lt(5))));
|
EXPECT_THAT(p, AllOf(Pointee(Eq(3)), Pointee(Gt(0)), Pointee(Lt(5))));
|
||||||
EXPECT_THAT(p, Not(AllOf(Pointee(Eq(3)), Pointee(Gt(0)), Pointee(Lt(3)))));
|
EXPECT_THAT(p, Not(AllOf(Pointee(Eq(3)), Pointee(Gt(0)), Pointee(Lt(3)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AnyOfTest, WorksOnMoveOnlyType) {
|
TEST(AnyOfTest, WorksOnMoveOnlyType) {
|
||||||
std::unique_ptr<int> p(new int(3));
|
std::unique_ptr<int> p = std::make_unique<int>(3);
|
||||||
EXPECT_THAT(p, AnyOf(Pointee(Eq(5)), Pointee(Lt(0)), Pointee(Lt(5))));
|
EXPECT_THAT(p, AnyOf(Pointee(Eq(5)), Pointee(Lt(0)), Pointee(Lt(5))));
|
||||||
EXPECT_THAT(p, Not(AnyOf(Pointee(Eq(5)), Pointee(Lt(0)), Pointee(Gt(5)))));
|
EXPECT_THAT(p, Not(AnyOf(Pointee(Eq(5)), Pointee(Lt(0)), Pointee(Gt(5)))));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -217,7 +217,7 @@ TEST(PointeeTest, ReferenceToNonConstRawPointer) {
|
|||||||
TEST(PointeeTest, SmartPointer) {
|
TEST(PointeeTest, SmartPointer) {
|
||||||
const Matcher<std::unique_ptr<int>> m = Pointee(Ge(0));
|
const Matcher<std::unique_ptr<int>> m = Pointee(Ge(0));
|
||||||
|
|
||||||
std::unique_ptr<int> n(new int(1));
|
std::unique_ptr<int> n = std::make_unique<int>(1);
|
||||||
EXPECT_TRUE(m.Matches(n));
|
EXPECT_TRUE(m.Matches(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ TEST(PointerTest, RawPointerToConst) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(PointerTest, SmartPointer) {
|
TEST(PointerTest, SmartPointer) {
|
||||||
std::unique_ptr<int> n(new int(10));
|
std::unique_ptr<int> n = std::make_unique<int>(10);
|
||||||
int* raw_n = n.get();
|
int* raw_n = n.get();
|
||||||
const Matcher<std::unique_ptr<int>> m = Pointer(Eq(raw_n));
|
const Matcher<std::unique_ptr<int>> m = Pointer(Eq(raw_n));
|
||||||
|
|
||||||
@ -2796,7 +2796,7 @@ TEST(UnorderedPointwiseTest, WorksWithMoveOnly) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(PointeeTest, WorksOnMoveOnlyType) {
|
TEST(PointeeTest, WorksOnMoveOnlyType) {
|
||||||
std::unique_ptr<int> p(new int(3));
|
std::unique_ptr<int> p = std::make_unique<int>(3);
|
||||||
EXPECT_THAT(p, Pointee(Eq(3)));
|
EXPECT_THAT(p, Pointee(Eq(3)));
|
||||||
EXPECT_THAT(p, Not(Pointee(Eq(2))));
|
EXPECT_THAT(p, Not(Pointee(Eq(2))));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,7 +79,7 @@ TEST(AddressTest, Const) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(AddressTest, MatcherDoesntCopy) {
|
TEST(AddressTest, MatcherDoesntCopy) {
|
||||||
std::unique_ptr<int> n(new int(1));
|
std::unique_ptr<int> n = std::make_unique<int>(1);
|
||||||
const Matcher<std::unique_ptr<int>> m = Address(Eq(&n));
|
const Matcher<std::unique_ptr<int>> m = Address(Eq(&n));
|
||||||
|
|
||||||
EXPECT_TRUE(m.Matches(n));
|
EXPECT_TRUE(m.Matches(n));
|
||||||
@ -202,7 +202,7 @@ TEST(IsTrueTest, IsTrueIsFalse) {
|
|||||||
EXPECT_THAT(nullptr, Not(IsTrue()));
|
EXPECT_THAT(nullptr, Not(IsTrue()));
|
||||||
EXPECT_THAT(nullptr, IsFalse());
|
EXPECT_THAT(nullptr, IsFalse());
|
||||||
std::unique_ptr<int> null_unique;
|
std::unique_ptr<int> null_unique;
|
||||||
std::unique_ptr<int> nonnull_unique(new int(0));
|
std::unique_ptr<int> nonnull_unique = std::make_unique<int>(0);
|
||||||
EXPECT_THAT(null_unique, Not(IsTrue()));
|
EXPECT_THAT(null_unique, Not(IsTrue()));
|
||||||
EXPECT_THAT(null_unique, IsFalse());
|
EXPECT_THAT(null_unique, IsFalse());
|
||||||
EXPECT_THAT(nonnull_unique, IsTrue());
|
EXPECT_THAT(nonnull_unique, IsTrue());
|
||||||
@ -1665,7 +1665,7 @@ MATCHER(IsNotNull, "") { return arg != nullptr; }
|
|||||||
// Verifies that a matcher defined using MATCHER() can work on
|
// Verifies that a matcher defined using MATCHER() can work on
|
||||||
// move-only types.
|
// move-only types.
|
||||||
TEST(MatcherMacroTest, WorksOnMoveOnlyType) {
|
TEST(MatcherMacroTest, WorksOnMoveOnlyType) {
|
||||||
std::unique_ptr<int> p(new int(3));
|
std::unique_ptr<int> p = std::make_unique<int>(3);
|
||||||
EXPECT_THAT(p, IsNotNull());
|
EXPECT_THAT(p, IsNotNull());
|
||||||
EXPECT_THAT(std::unique_ptr<int>(), Not(IsNotNull()));
|
EXPECT_THAT(std::unique_ptr<int>(), Not(IsNotNull()));
|
||||||
}
|
}
|
||||||
@ -1675,7 +1675,7 @@ MATCHER_P(UniquePointee, pointee, "") { return *arg == pointee; }
|
|||||||
// Verifies that a matcher defined using MATCHER_P*() can work on
|
// Verifies that a matcher defined using MATCHER_P*() can work on
|
||||||
// move-only types.
|
// move-only types.
|
||||||
TEST(MatcherPMacroTest, WorksOnMoveOnlyType) {
|
TEST(MatcherPMacroTest, WorksOnMoveOnlyType) {
|
||||||
std::unique_ptr<int> p(new int(3));
|
std::unique_ptr<int> p = std::make_unique<int>(3);
|
||||||
EXPECT_THAT(p, UniquePointee(3));
|
EXPECT_THAT(p, UniquePointee(3));
|
||||||
EXPECT_THAT(p, Not(UniquePointee(2)));
|
EXPECT_THAT(p, Not(UniquePointee(2)));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user