[llvm-branch-commits] [llvm] e8021f3 - ADT: Remove the unused explicit `OptionalTest` fixture, NFC
Duncan P. N. Exon Smith via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Dec 8 15:29:17 PST 2020
Author: Duncan P. N. Exon Smith
Date: 2020-12-08T15:25:03-08:00
New Revision: e8021f34e1bae8537aba3c834ff0a9a73ad93405
URL: https://github.com/llvm/llvm-project/commit/e8021f34e1bae8537aba3c834ff0a9a73ad93405
DIFF: https://github.com/llvm/llvm-project/commit/e8021f34e1bae8537aba3c834ff0a9a73ad93405.diff
LOG: ADT: Remove the unused explicit `OptionalTest` fixture, NFC
`OptionalTest` was empty; drop it and switch all the tests to use the
shorter `TEST` instead of `TEST_F`.
Differential Revision: https://reviews.llvm.org/D92675
Added:
Modified:
llvm/unittests/ADT/OptionalTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/ADT/OptionalTest.cpp b/llvm/unittests/ADT/OptionalTest.cpp
index 7506453c4d90..17a764041c8c 100644
--- a/llvm/unittests/ADT/OptionalTest.cpp
+++ b/llvm/unittests/ADT/OptionalTest.cpp
@@ -69,16 +69,12 @@ static_assert(
!std::is_trivially_copyable<Optional<NonDefaultConstructible>>::value,
"not trivially copyable");
-// Test fixture
-class OptionalTest : public testing::Test {
-};
-
-TEST_F(OptionalTest, NonDefaultConstructibleTest) {
+TEST(OptionalTest, NonDefaultConstructibleTest) {
Optional<NonDefaultConstructible> O;
EXPECT_FALSE(O);
}
-TEST_F(OptionalTest, ResetTest) {
+TEST(OptionalTest, ResetTest) {
NonDefaultConstructible::ResetCounts();
Optional<NonDefaultConstructible> O(NonDefaultConstructible(3));
EXPECT_EQ(1u, NonDefaultConstructible::CopyConstructions);
@@ -91,7 +87,7 @@ TEST_F(OptionalTest, ResetTest) {
EXPECT_EQ(1u, NonDefaultConstructible::Destructions);
}
-TEST_F(OptionalTest, InitializationLeakTest) {
+TEST(OptionalTest, InitializationLeakTest) {
NonDefaultConstructible::ResetCounts();
Optional<NonDefaultConstructible>(NonDefaultConstructible(3));
EXPECT_EQ(1u, NonDefaultConstructible::CopyConstructions);
@@ -99,7 +95,7 @@ TEST_F(OptionalTest, InitializationLeakTest) {
EXPECT_EQ(2u, NonDefaultConstructible::Destructions);
}
-TEST_F(OptionalTest, CopyConstructionTest) {
+TEST(OptionalTest, CopyConstructionTest) {
NonDefaultConstructible::ResetCounts();
{
Optional<NonDefaultConstructible> A(NonDefaultConstructible(3));
@@ -118,7 +114,7 @@ TEST_F(OptionalTest, CopyConstructionTest) {
EXPECT_EQ(2u, NonDefaultConstructible::Destructions);
}
-TEST_F(OptionalTest, ConstructingCopyAssignmentTest) {
+TEST(OptionalTest, ConstructingCopyAssignmentTest) {
NonDefaultConstructible::ResetCounts();
{
Optional<NonDefaultConstructible> A(NonDefaultConstructible(3));
@@ -138,7 +134,7 @@ TEST_F(OptionalTest, ConstructingCopyAssignmentTest) {
EXPECT_EQ(2u, NonDefaultConstructible::Destructions);
}
-TEST_F(OptionalTest, CopyingCopyAssignmentTest) {
+TEST(OptionalTest, CopyingCopyAssignmentTest) {
NonDefaultConstructible::ResetCounts();
{
Optional<NonDefaultConstructible> A(NonDefaultConstructible(3));
@@ -158,7 +154,7 @@ TEST_F(OptionalTest, CopyingCopyAssignmentTest) {
EXPECT_EQ(2u, NonDefaultConstructible::Destructions);
}
-TEST_F(OptionalTest, DeletingCopyAssignmentTest) {
+TEST(OptionalTest, DeletingCopyAssignmentTest) {
NonDefaultConstructible::ResetCounts();
{
Optional<NonDefaultConstructible> A;
@@ -178,7 +174,7 @@ TEST_F(OptionalTest, DeletingCopyAssignmentTest) {
EXPECT_EQ(0u, NonDefaultConstructible::Destructions);
}
-TEST_F(OptionalTest, NullCopyConstructionTest) {
+TEST(OptionalTest, NullCopyConstructionTest) {
NonDefaultConstructible::ResetCounts();
{
Optional<NonDefaultConstructible> A;
@@ -198,7 +194,7 @@ TEST_F(OptionalTest, NullCopyConstructionTest) {
EXPECT_EQ(0u, NonDefaultConstructible::Destructions);
}
-TEST_F(OptionalTest, GetValueOr) {
+TEST(OptionalTest, GetValueOr) {
Optional<int> A;
EXPECT_EQ(42, A.getValueOr(42));
@@ -230,7 +226,7 @@ unsigned MultiArgConstructor::Destructions = 0;
static_assert(!std::is_trivially_copyable<Optional<MultiArgConstructor>>::value,
"not trivially copyable");
-TEST_F(OptionalTest, Emplace) {
+TEST(OptionalTest, Emplace) {
MultiArgConstructor::ResetCounts();
Optional<MultiArgConstructor> A;
@@ -280,7 +276,7 @@ unsigned MoveOnly::MoveAssignments = 0;
static_assert(!std::is_trivially_copyable<Optional<MoveOnly>>::value,
"not trivially copyable");
-TEST_F(OptionalTest, MoveOnlyNull) {
+TEST(OptionalTest, MoveOnlyNull) {
MoveOnly::ResetCounts();
Optional<MoveOnly> O;
EXPECT_EQ(0u, MoveOnly::MoveConstructions);
@@ -288,7 +284,7 @@ TEST_F(OptionalTest, MoveOnlyNull) {
EXPECT_EQ(0u, MoveOnly::Destructions);
}
-TEST_F(OptionalTest, MoveOnlyConstruction) {
+TEST(OptionalTest, MoveOnlyConstruction) {
MoveOnly::ResetCounts();
Optional<MoveOnly> O(MoveOnly(3));
EXPECT_TRUE((bool)O);
@@ -298,7 +294,7 @@ TEST_F(OptionalTest, MoveOnlyConstruction) {
EXPECT_EQ(1u, MoveOnly::Destructions);
}
-TEST_F(OptionalTest, MoveOnlyMoveConstruction) {
+TEST(OptionalTest, MoveOnlyMoveConstruction) {
Optional<MoveOnly> A(MoveOnly(3));
MoveOnly::ResetCounts();
Optional<MoveOnly> B(std::move(A));
@@ -310,7 +306,7 @@ TEST_F(OptionalTest, MoveOnlyMoveConstruction) {
EXPECT_EQ(0u, MoveOnly::Destructions);
}
-TEST_F(OptionalTest, MoveOnlyAssignment) {
+TEST(OptionalTest, MoveOnlyAssignment) {
MoveOnly::ResetCounts();
Optional<MoveOnly> O;
O = MoveOnly(3);
@@ -321,7 +317,7 @@ TEST_F(OptionalTest, MoveOnlyAssignment) {
EXPECT_EQ(1u, MoveOnly::Destructions);
}
-TEST_F(OptionalTest, MoveOnlyInitializingAssignment) {
+TEST(OptionalTest, MoveOnlyInitializingAssignment) {
Optional<MoveOnly> A(MoveOnly(3));
Optional<MoveOnly> B;
MoveOnly::ResetCounts();
@@ -334,7 +330,7 @@ TEST_F(OptionalTest, MoveOnlyInitializingAssignment) {
EXPECT_EQ(0u, MoveOnly::Destructions);
}
-TEST_F(OptionalTest, MoveOnlyNullingAssignment) {
+TEST(OptionalTest, MoveOnlyNullingAssignment) {
Optional<MoveOnly> A;
Optional<MoveOnly> B(MoveOnly(3));
MoveOnly::ResetCounts();
@@ -346,7 +342,7 @@ TEST_F(OptionalTest, MoveOnlyNullingAssignment) {
EXPECT_EQ(1u, MoveOnly::Destructions);
}
-TEST_F(OptionalTest, MoveOnlyAssigningAssignment) {
+TEST(OptionalTest, MoveOnlyAssigningAssignment) {
Optional<MoveOnly> A(MoveOnly(3));
Optional<MoveOnly> B(MoveOnly(4));
MoveOnly::ResetCounts();
@@ -384,7 +380,7 @@ unsigned Immovable::Destructions = 0;
static_assert(!std::is_trivially_copyable<Optional<Immovable>>::value,
"not trivially copyable");
-TEST_F(OptionalTest, ImmovableEmplace) {
+TEST(OptionalTest, ImmovableEmplace) {
Optional<Immovable> A;
Immovable::ResetCounts();
A.emplace(4);
@@ -396,7 +392,7 @@ TEST_F(OptionalTest, ImmovableEmplace) {
#if LLVM_HAS_RVALUE_REFERENCE_THIS
-TEST_F(OptionalTest, MoveGetValueOr) {
+TEST(OptionalTest, MoveGetValueOr) {
Optional<MoveOnly> A;
MoveOnly::ResetCounts();
@@ -478,7 +474,7 @@ bool operator==(const EqualityMock &Lhs, const EqualityMock &Rhs) {
return IsEqual;
}
-TEST_F(OptionalTest, OperatorEqual) {
+TEST(OptionalTest, OperatorEqual) {
CheckRelation<EqualTo>(NoneEq, NoneEq, true);
CheckRelation<EqualTo>(NoneEq, EqualityRhs, false);
CheckRelation<EqualTo>(EqualityLhs, NoneEq, false);
@@ -489,7 +485,7 @@ TEST_F(OptionalTest, OperatorEqual) {
CheckRelation<EqualTo>(EqualityLhs, EqualityRhs, IsEqual);
}
-TEST_F(OptionalTest, OperatorNotEqual) {
+TEST(OptionalTest, OperatorNotEqual) {
CheckRelation<NotEqualTo>(NoneEq, NoneEq, false);
CheckRelation<NotEqualTo>(NoneEq, EqualityRhs, true);
CheckRelation<NotEqualTo>(EqualityLhs, NoneEq, true);
@@ -511,7 +507,7 @@ bool operator<(const InequalityMock &Lhs, const InequalityMock &Rhs) {
return IsLess;
}
-TEST_F(OptionalTest, OperatorLess) {
+TEST(OptionalTest, OperatorLess) {
CheckRelation<Less>(NoneIneq, NoneIneq, false);
CheckRelation<Less>(NoneIneq, InequalityRhs, true);
CheckRelation<Less>(InequalityLhs, NoneIneq, false);
@@ -522,7 +518,7 @@ TEST_F(OptionalTest, OperatorLess) {
CheckRelation<Less>(InequalityLhs, InequalityRhs, IsLess);
}
-TEST_F(OptionalTest, OperatorGreater) {
+TEST(OptionalTest, OperatorGreater) {
CheckRelation<Greater>(NoneIneq, NoneIneq, false);
CheckRelation<Greater>(NoneIneq, InequalityRhs, false);
CheckRelation<Greater>(InequalityLhs, NoneIneq, true);
@@ -533,7 +529,7 @@ TEST_F(OptionalTest, OperatorGreater) {
CheckRelation<Greater>(InequalityRhs, InequalityLhs, IsLess);
}
-TEST_F(OptionalTest, OperatorLessEqual) {
+TEST(OptionalTest, OperatorLessEqual) {
CheckRelation<LessEqual>(NoneIneq, NoneIneq, true);
CheckRelation<LessEqual>(NoneIneq, InequalityRhs, true);
CheckRelation<LessEqual>(InequalityLhs, NoneIneq, false);
@@ -544,7 +540,7 @@ TEST_F(OptionalTest, OperatorLessEqual) {
CheckRelation<LessEqual>(InequalityRhs, InequalityLhs, !IsLess);
}
-TEST_F(OptionalTest, OperatorGreaterEqual) {
+TEST(OptionalTest, OperatorGreaterEqual) {
CheckRelation<GreaterEqual>(NoneIneq, NoneIneq, true);
CheckRelation<GreaterEqual>(NoneIneq, InequalityRhs, false);
CheckRelation<GreaterEqual>(InequalityLhs, NoneIneq, true);
@@ -570,7 +566,7 @@ struct ComparableAndStreamable {
}
};
-TEST_F(OptionalTest, StreamOperator) {
+TEST(OptionalTest, StreamOperator) {
auto to_string = [](Optional<ComparableAndStreamable> O) {
SmallString<16> S;
raw_svector_ostream OS(S);
@@ -589,7 +585,7 @@ struct Comparable {
static Optional<Comparable> get() { return Comparable(); }
};
-TEST_F(OptionalTest, UseInUnitTests) {
+TEST(OptionalTest, UseInUnitTests) {
// Test that we invoke the streaming operators when pretty-printing values in
// EXPECT macros.
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(llvm::None, ComparableAndStreamable::get()),
More information about the llvm-branch-commits
mailing list