diff --git a/llvm/unittests/Support/Casting.cpp b/llvm/unittests/Support/Casting.cpp
--- a/llvm/unittests/Support/Casting.cpp
+++ b/llvm/unittests/Support/Casting.cpp
@@ -283,7 +283,7 @@
Derived D;
EXPECT_TRUE(isa(D));
Base *BP = dyn_cast(&D);
- EXPECT_TRUE(BP != nullptr);
+ EXPECT_NE(BP, nullptr);
}
@@ -379,31 +379,31 @@
}
TEST(CastingTest, smart_cast) {
- EXPECT_TRUE(cast(MD) == &D);
- EXPECT_TRUE(cast(CD) == &D);
+ EXPECT_EQ(cast(MD), &D);
+ EXPECT_EQ(cast(CD), &D);
}
TEST(CastingTest, smart_cast_or_null) {
- EXPECT_TRUE(cast_or_null(MN) == nullptr);
- EXPECT_TRUE(cast_or_null(CN) == nullptr);
- EXPECT_TRUE(cast_or_null(MD) == &D);
- EXPECT_TRUE(cast_or_null(CD) == &D);
+ EXPECT_EQ(cast_or_null(MN), nullptr);
+ EXPECT_EQ(cast_or_null(CN), nullptr);
+ EXPECT_EQ(cast_or_null(MD), &D);
+ EXPECT_EQ(cast_or_null(CD), &D);
}
TEST(CastingTest, smart_dyn_cast) {
- EXPECT_TRUE(dyn_cast(MB) == nullptr);
- EXPECT_TRUE(dyn_cast(CB) == nullptr);
- EXPECT_TRUE(dyn_cast(MD) == &D);
- EXPECT_TRUE(dyn_cast(CD) == &D);
+ EXPECT_EQ(dyn_cast(MB), nullptr);
+ EXPECT_EQ(dyn_cast(CB), nullptr);
+ EXPECT_EQ(dyn_cast(MD), &D);
+ EXPECT_EQ(dyn_cast(CD), &D);
}
TEST(CastingTest, smart_dyn_cast_or_null) {
- EXPECT_TRUE(dyn_cast_or_null(MN) == nullptr);
- EXPECT_TRUE(dyn_cast_or_null(CN) == nullptr);
- EXPECT_TRUE(dyn_cast_or_null(MB) == nullptr);
- EXPECT_TRUE(dyn_cast_or_null(CB) == nullptr);
- EXPECT_TRUE(dyn_cast_or_null(MD) == &D);
- EXPECT_TRUE(dyn_cast_or_null(CD) == &D);
+ EXPECT_EQ(dyn_cast_or_null(MN), nullptr);
+ EXPECT_EQ(dyn_cast_or_null(CN), nullptr);
+ EXPECT_EQ(dyn_cast_or_null(MB), nullptr);
+ EXPECT_EQ(dyn_cast_or_null(CB), nullptr);
+ EXPECT_EQ(dyn_cast_or_null(MD), &D);
+ EXPECT_EQ(dyn_cast_or_null(CD), &D);
}
} // end namespace pointer_wrappers
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp
--- a/llvm/unittests/Support/CommandLineTest.cpp
+++ b/llvm/unittests/Support/CommandLineTest.cpp
@@ -101,8 +101,7 @@
StringMap &Map =
cl::getRegisteredOptions(*cl::TopLevelSubCommand);
- ASSERT_TRUE(Map.count("test-option") == 1) <<
- "Could not find option in map.";
+ ASSERT_EQ(Map.count("test-option"), 1u) << "Could not find option in map.";
cl::Option *Retrieved = Map["test-option"];
ASSERT_EQ(&TestOption, Retrieved) << "Retrieved wrong option.";
@@ -701,7 +700,7 @@
const char *args0[] = {"prog", "-b", "args0 bar string", "-f"};
EXPECT_TRUE(cl::ParseCommandLineOptions(sizeof(args0) / sizeof(char *), args0,
StringRef(), &llvm::nulls()));
- EXPECT_TRUE(Bar == "args0 bar string");
+ EXPECT_EQ(Bar, "args0 bar string");
EXPECT_TRUE(Foo);
EXPECT_FALSE(SC1_B);
EXPECT_TRUE(SC2_Foo.empty());
@@ -711,7 +710,7 @@
const char *args1[] = {"prog", "sc1", "-b", "-bar", "args1 bar string", "-f"};
EXPECT_TRUE(cl::ParseCommandLineOptions(sizeof(args1) / sizeof(char *), args1,
StringRef(), &llvm::nulls()));
- EXPECT_TRUE(Bar == "args1 bar string");
+ EXPECT_EQ(Bar, "args1 bar string");
EXPECT_TRUE(Foo);
EXPECT_TRUE(SC1_B);
EXPECT_TRUE(SC2_Foo.empty());
@@ -727,10 +726,10 @@
"-f", "-foo", "foo string"};
EXPECT_TRUE(cl::ParseCommandLineOptions(sizeof(args2) / sizeof(char *), args2,
StringRef(), &llvm::nulls()));
- EXPECT_TRUE(Bar == "args2 bar string");
+ EXPECT_EQ(Bar, "args2 bar string");
EXPECT_TRUE(Foo);
EXPECT_FALSE(SC1_B);
- EXPECT_TRUE(SC2_Foo == "foo string");
+ EXPECT_EQ(SC2_Foo, "foo string");
for (auto *S : cl::getRegisteredSubcommands()) {
if (*S) {
EXPECT_EQ("sc2", S->getName());
@@ -777,8 +776,8 @@
EXPECT_TRUE(
cl::ParseCommandLineOptions(2, args, StringRef(), &llvm::nulls()));
EXPECT_TRUE(TopLevelOpt);
- EXPECT_TRUE(InputFilenames[0] == "path\\dir\\file1");
- EXPECT_TRUE(InputFilenames[1] == "path/dir/file2");
+ EXPECT_EQ(InputFilenames[0], "path\\dir\\file1");
+ EXPECT_EQ(InputFilenames[1], "path/dir/file2");
}
TEST(CommandLineTest, ResponseFiles) {
@@ -1011,9 +1010,9 @@
EXPECT_TRUE(
cl::ParseCommandLineOptions(2, args, StringRef(), &llvm::nulls()));
- EXPECT_TRUE(Opt1 == "false");
+ EXPECT_EQ(Opt1, "false");
EXPECT_TRUE(Opt2);
- EXPECT_TRUE(Opt3 == 3);
+ EXPECT_EQ(Opt3, 3);
Opt2 = false;
Opt3 = 1;
@@ -1028,9 +1027,9 @@
O->setDefault();
}
- EXPECT_TRUE(Opt1 == "true");
+ EXPECT_EQ(Opt1, "true");
EXPECT_TRUE(Opt2);
- EXPECT_TRUE(Opt3 == 3);
+ EXPECT_EQ(Opt3, 3);
Alias.removeArgument();
}
@@ -1135,8 +1134,8 @@
cl::ResetAllOptionOccurrences();
EXPECT_TRUE(cl::ParseCommandLineOptions(6, args4, StringRef(), &OS)); OS.flush();
- EXPECT_TRUE(PosEatArgs.size() == 1);
- EXPECT_TRUE(PosEatArgs2.size() == 2);
+ EXPECT_EQ(PosEatArgs.size(), 1u);
+ EXPECT_EQ(PosEatArgs2.size(), 2u);
EXPECT_TRUE(Errs.empty());
}
@@ -1412,8 +1411,8 @@
const char *args[] = {"prog", "-I=/usr/include"};
EXPECT_TRUE(
cl::ParseCommandLineOptions(2, args, StringRef(), &llvm::nulls()));
- EXPECT_TRUE(IncludeDirs.size() == 1);
- EXPECT_TRUE(IncludeDirs.front().compare("/usr/include") == 0);
+ EXPECT_EQ(IncludeDirs.size(), 1u);
+ EXPECT_EQ(IncludeDirs.front().compare("/usr/include"), 0);
IncludeDirs.erase(IncludeDirs.begin());
cl::ResetAllOptionOccurrences();
@@ -1424,8 +1423,8 @@
const char *args2[] = {"prog", "-I", "/usr/include"};
EXPECT_TRUE(
cl::ParseCommandLineOptions(3, args2, StringRef(), &llvm::nulls()));
- EXPECT_TRUE(IncludeDirs.size() == 1);
- EXPECT_TRUE(IncludeDirs.front().compare("/usr/include") == 0);
+ EXPECT_EQ(IncludeDirs.size(), 1u);
+ EXPECT_EQ(IncludeDirs.front().compare("/usr/include"), 0);
IncludeDirs.erase(IncludeDirs.begin());
cl::ResetAllOptionOccurrences();
@@ -1435,8 +1434,8 @@
const char *args3[] = {"prog", "-I/usr/include"};
EXPECT_TRUE(
cl::ParseCommandLineOptions(2, args3, StringRef(), &llvm::nulls()));
- EXPECT_TRUE(IncludeDirs.size() == 1);
- EXPECT_TRUE(IncludeDirs.front().compare("/usr/include") == 0);
+ EXPECT_EQ(IncludeDirs.size(), 1u);
+ EXPECT_EQ(IncludeDirs.front().compare("/usr/include"), 0);
StackOption> MacroDefs(
"D", cl::AlwaysPrefix, cl::desc("Define a macro"),
@@ -1450,8 +1449,8 @@
const char *args4[] = {"prog", "-D=HAVE_FOO"};
EXPECT_TRUE(
cl::ParseCommandLineOptions(2, args4, StringRef(), &llvm::nulls()));
- EXPECT_TRUE(MacroDefs.size() == 1);
- EXPECT_TRUE(MacroDefs.front().compare("=HAVE_FOO") == 0);
+ EXPECT_EQ(MacroDefs.size(), 1u);
+ EXPECT_EQ(MacroDefs.front().compare("=HAVE_FOO"), 0);
MacroDefs.erase(MacroDefs.begin());
cl::ResetAllOptionOccurrences();
@@ -1471,8 +1470,8 @@
const char *args6[] = {"prog", "-DHAVE_FOO"};
EXPECT_TRUE(
cl::ParseCommandLineOptions(2, args6, StringRef(), &llvm::nulls()));
- EXPECT_TRUE(MacroDefs.size() == 1);
- EXPECT_TRUE(MacroDefs.front().compare("HAVE_FOO") == 0);
+ EXPECT_EQ(MacroDefs.size(), 1u);
+ EXPECT_EQ(MacroDefs.front().compare("HAVE_FOO"), 0);
}
TEST(CommandLineTest, GroupingWithValue) {
@@ -1757,12 +1756,12 @@
OptA.error("custom error", OS);
OS.flush();
- EXPECT_FALSE(Errs.find("for the -a option:") == std::string::npos);
+ EXPECT_NE(Errs.find("for the -a option:"), std::string::npos);
Errs.clear();
OptLong.error("custom error", OS);
OS.flush();
- EXPECT_FALSE(Errs.find("for the --long option:") == std::string::npos);
+ EXPECT_NE(Errs.find("for the --long option:"), std::string::npos);
Errs.clear();
cl::ResetAllOptionOccurrences();
@@ -1785,8 +1784,8 @@
EXPECT_FALSE(cl::ParseCommandLineOptions(2, args, StringRef(), &OS));
OS.flush();
- EXPECT_FALSE(Errs.find("prog: Did you mean '--aluminium'?\n") ==
- std::string::npos);
+ EXPECT_NE(Errs.find("prog: Did you mean '--aluminium'?\n"),
+ std::string::npos);
Errs.clear();
cl::ResetAllOptionOccurrences();
@@ -1808,8 +1807,8 @@
EXPECT_FALSE(cl::ParseCommandLineOptions(2, args, StringRef(), &OS));
OS.flush();
- EXPECT_FALSE(Errs.find("prog: Did you mean '--aluminium'?\n") ==
- std::string::npos);
+ EXPECT_NE(Errs.find("prog: Did you mean '--aluminium'?\n"),
+ std::string::npos);
Errs.clear();
cl::ResetAllOptionOccurrences();
@@ -1840,7 +1839,7 @@
EXPECT_TRUE(OptA);
EXPECT_FALSE(OptB);
EXPECT_FALSE(OptC);
- EXPECT_TRUE(List.size() == 0);
+ EXPECT_EQ(List.size(), 0u);
cl::ResetAllOptionOccurrences();
const char *args2[] = {"prog", "-b"};
@@ -1848,7 +1847,7 @@
EXPECT_TRUE(OptA);
EXPECT_TRUE(OptB);
EXPECT_FALSE(OptC);
- EXPECT_TRUE(List.size() == 0);
+ EXPECT_EQ(List.size(), 0u);
cl::ResetAllOptionOccurrences();
const char *args3[] = {"prog", "-c"};
@@ -1856,7 +1855,7 @@
EXPECT_TRUE(OptA);
EXPECT_TRUE(OptB);
EXPECT_TRUE(OptC);
- EXPECT_TRUE(List.size() == 0);
+ EXPECT_EQ(List.size(), 0u);
cl::ResetAllOptionOccurrences();
const char *args4[] = {"prog", "--list=foo,bar"};
@@ -1864,7 +1863,7 @@
EXPECT_TRUE(OptA);
EXPECT_TRUE(OptB);
EXPECT_TRUE(OptC);
- EXPECT_TRUE(List.size() == 2);
+ EXPECT_EQ(List.size(), 2u);
cl::ResetAllOptionOccurrences();
const char *args5[] = {"prog", "--list=bar"};
@@ -1872,7 +1871,7 @@
EXPECT_FALSE(OptA);
EXPECT_FALSE(OptB);
EXPECT_FALSE(OptC);
- EXPECT_TRUE(List.size() == 1);
+ EXPECT_EQ(List.size(), 1u);
cl::ResetAllOptionOccurrences();
}
@@ -1899,9 +1898,9 @@
EXPECT_TRUE(cl::ParseCommandLineOptions(4, Args, StringRef(), &OS));
OS.flush();
EXPECT_EQ("input", Input);
- EXPECT_TRUE(ExtraArgs.size() == 2);
- EXPECT_TRUE(ExtraArgs[0] == "arg1");
- EXPECT_TRUE(ExtraArgs[1] == "arg2");
+ EXPECT_EQ(ExtraArgs.size(), 2u);
+ EXPECT_EQ(ExtraArgs[0], "arg1");
+ EXPECT_EQ(ExtraArgs[1], "arg2");
EXPECT_TRUE(Errs.empty());
}
@@ -1923,9 +1922,9 @@
OS.flush();
EXPECT_EQ("input1", Input1);
EXPECT_EQ("input2", Input2);
- EXPECT_TRUE(ExtraArgs.size() == 2);
- EXPECT_TRUE(ExtraArgs[0] == "arg1");
- EXPECT_TRUE(ExtraArgs[1] == "arg2");
+ EXPECT_EQ(ExtraArgs.size(), 2u);
+ EXPECT_EQ(ExtraArgs[0], "arg1");
+ EXPECT_EQ(ExtraArgs[1], "arg2");
EXPECT_TRUE(Errs.empty());
}
@@ -1946,17 +1945,17 @@
EXPECT_TRUE(OS.str().empty());
EXPECT_TRUE(Option);
- EXPECT_EQ(1, (int)Sink.size());
+ EXPECT_EQ(1u, Sink.size());
EXPECT_EQ("-unknown", Sink[0]);
EXPECT_EQ("input", Input);
- EXPECT_EQ(1, (int)ExtraArgs.size());
+ EXPECT_EQ(1u, ExtraArgs.size());
EXPECT_EQ("-arg", ExtraArgs[0]);
cl::ResetAllOptionOccurrences();
EXPECT_FALSE(Option);
- EXPECT_EQ(0, (int)Sink.size());
+ EXPECT_EQ(0u, Sink.size());
EXPECT_EQ(0, Input.getNumOccurrences());
- EXPECT_EQ(0, (int)ExtraArgs.size());
+ EXPECT_EQ(0u, ExtraArgs.size());
}
} // anonymous namespace
diff --git a/llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp b/llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
--- a/llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
+++ b/llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
@@ -66,11 +66,13 @@
EXPECT_TRUE(Err.empty());
GetString GS = FuncPtr(DL.getAddressOfSymbol("TestA"));
- EXPECT_TRUE(GS != nullptr && GS != &TestA);
+ EXPECT_NE(GS, nullptr);
+ EXPECT_NE(GS, &TestA);
EXPECT_EQ(StdString(GS()), "LibCall");
GS = FuncPtr(DynamicLibrary::SearchForAddressOfSymbol("TestA"));
- EXPECT_TRUE(GS != nullptr && GS != &TestA);
+ EXPECT_NE(GS, nullptr);
+ EXPECT_NE(GS, &TestA);
EXPECT_EQ(StdString(GS()), "LibCall");
DL = DynamicLibrary::getPermanentLibrary(nullptr, &Err);
@@ -79,32 +81,37 @@
// Test overloading local symbols does not occur by default
GS = FuncPtr(DynamicLibrary::SearchForAddressOfSymbol("TestA"));
- EXPECT_TRUE(GS != nullptr && GS == &TestA);
+ EXPECT_NE(GS, nullptr);
+ EXPECT_EQ(GS, &TestA);
EXPECT_EQ(StdString(GS()), "ProcessCall");
GS = FuncPtr(DL.getAddressOfSymbol("TestA"));
- EXPECT_TRUE(GS != nullptr && GS == &TestA);
+ EXPECT_NE(GS, nullptr);
+ EXPECT_EQ(GS, &TestA);
EXPECT_EQ(StdString(GS()), "ProcessCall");
// Test overloading by forcing library priority when searching for a symbol
DynamicLibrary::SearchOrder = DynamicLibrary::SO_LoadedFirst;
GS = FuncPtr(DynamicLibrary::SearchForAddressOfSymbol("TestA"));
- EXPECT_TRUE(GS != nullptr && GS != &TestA);
+ EXPECT_NE(GS, nullptr);
+ EXPECT_NE(GS, &TestA);
EXPECT_EQ(StdString(GS()), "LibCall");
DynamicLibrary::AddSymbol("TestA", PtrFunc(&OverloadTestA));
GS = FuncPtr(DL.getAddressOfSymbol("TestA"));
- EXPECT_TRUE(GS != nullptr && GS != &OverloadTestA);
+ EXPECT_NE(GS, nullptr);
+ EXPECT_NE(GS, &OverloadTestA);
GS = FuncPtr(DynamicLibrary::SearchForAddressOfSymbol("TestA"));
- EXPECT_TRUE(GS != nullptr && GS == &OverloadTestA);
+ EXPECT_NE(GS, nullptr);
+ EXPECT_EQ(GS, &OverloadTestA);
EXPECT_EQ(StdString(GS()), "OverloadCall");
}
EXPECT_TRUE(FuncPtr(DynamicLibrary::SearchForAddressOfSymbol(
"TestA")) == nullptr);
// Check serach ordering is reset to default after call to llvm_shutdown
- EXPECT_TRUE(DynamicLibrary::SearchOrder == DynamicLibrary::SO_Linker);
+ EXPECT_EQ(DynamicLibrary::SearchOrder, DynamicLibrary::SO_Linker);
}
TEST(DynamicLibrary, Shutdown) {
@@ -120,15 +127,15 @@
SetStrings SS_0 = FuncPtr(
DynamicLibrary::SearchForAddressOfSymbol("SetStrings"));
- EXPECT_TRUE(SS_0 != nullptr);
+ EXPECT_NE(SS_0, nullptr);
SS_0(A, B);
EXPECT_EQ(B, "Local::Local(PipSqueak)");
TestOrder TO_0 = FuncPtr(
DynamicLibrary::SearchForAddressOfSymbol("TestOrder"));
- EXPECT_TRUE(TO_0 != nullptr);
-
+ EXPECT_NE(TO_0, nullptr);
+
DynamicLibrary DL2 =
DynamicLibrary::getPermanentLibrary(LibPath(C).c_str(), &Err);
EXPECT_TRUE(DL2.isValid());
@@ -137,13 +144,13 @@
// Should find latest version of symbols in SecondLib
SetStrings SS_1 = FuncPtr(
DynamicLibrary::SearchForAddressOfSymbol("SetStrings"));
- EXPECT_TRUE(SS_1 != nullptr);
- EXPECT_TRUE(SS_0 != SS_1);
+ EXPECT_NE(SS_1, nullptr);
+ EXPECT_NE(SS_0, SS_1);
TestOrder TO_1 = FuncPtr(
DynamicLibrary::SearchForAddressOfSymbol("TestOrder"));
- EXPECT_TRUE(TO_1 != nullptr);
- EXPECT_TRUE(TO_0 != TO_1);
+ EXPECT_NE(TO_1, nullptr);
+ EXPECT_NE(TO_0, TO_1);
B.clear();
SS_1(C, B);
@@ -154,8 +161,9 @@
}
EXPECT_EQ(A, "Global::~Global");
EXPECT_EQ(B, "Local::~Local");
- EXPECT_TRUE(FuncPtr(DynamicLibrary::SearchForAddressOfSymbol(
- "SetStrings")) == nullptr);
+ EXPECT_EQ(FuncPtr(
+ DynamicLibrary::SearchForAddressOfSymbol("SetStrings")),
+ nullptr);
// Test unload/destruction ordering
EXPECT_EQ(Order.size(), 2UL);
diff --git a/llvm/unittests/Support/ErrorTest.cpp b/llvm/unittests/Support/ErrorTest.cpp
--- a/llvm/unittests/Support/ErrorTest.cpp
+++ b/llvm/unittests/Support/ErrorTest.cpp
@@ -179,7 +179,7 @@
CaughtErrorInfo = CE.getInfo();
});
- EXPECT_TRUE(CaughtErrorInfo == 42) << "Wrong result from CustomError handler";
+ EXPECT_EQ(CaughtErrorInfo, 42) << "Wrong result from CustomError handler";
}
// Check that handler type deduction also works for handlers
@@ -253,7 +253,8 @@
CaughtErrorExtraInfo = SE.getExtraInfo();
});
- EXPECT_TRUE(CaughtErrorInfo == 42 && CaughtErrorExtraInfo == 7)
+ EXPECT_EQ(CaughtErrorInfo, 42) << "Wrong result from CustomSubError handler";
+ EXPECT_EQ(CaughtErrorExtraInfo, 7)
<< "Wrong result from CustomSubError handler";
}
@@ -270,9 +271,9 @@
},
[&](const CustomError &CE) { DummyInfo = CE.getInfo(); });
- EXPECT_TRUE(CaughtErrorInfo == 42 && CaughtErrorExtraInfo == 7 &&
- DummyInfo == 0)
- << "Activated the wrong Error handler(s)";
+ EXPECT_EQ(CaughtErrorInfo, 42) << "Activated the wrong Error handler(s)";
+ EXPECT_EQ(CaughtErrorExtraInfo, 7) << "Activated the wrong Error handler(s)";
+ EXPECT_EQ(DummyInfo, 0) << "Activated the wrong Error handler(s)";
}
// Check that general handlers shadow specific ones.
@@ -289,7 +290,11 @@
DummyExtraInfo = SE.getExtraInfo();
});
- EXPECT_TRUE(CaughtErrorInfo == 42 && DummyInfo == 0 && DummyExtraInfo == 0)
+ EXPECT_EQ(CaughtErrorInfo, 42)
+ << "General Error handler did not shadow specific handler";
+ EXPECT_EQ(DummyInfo, 0)
+ << "General Error handler did not shadow specific handler";
+ EXPECT_EQ(DummyExtraInfo, 0)
<< "General Error handler did not shadow specific handler";
}
@@ -317,9 +322,9 @@
CustomErrorInfo1 = CE.getInfo();
});
- EXPECT_TRUE(CustomErrorInfo1 == 7 && CustomErrorInfo2 == 42 &&
- CustomErrorExtraInfo == 7)
- << "Failed handling compound Error.";
+ EXPECT_EQ(CustomErrorInfo1, 7) << "Failed handling compound Error.";
+ EXPECT_EQ(CustomErrorInfo2, 42) << "Failed handling compound Error.";
+ EXPECT_EQ(CustomErrorExtraInfo, 7) << "Failed handling compound Error.";
// Test appending a single item to a list.
{
diff --git a/llvm/unittests/Support/FSUniqueIDTest.cpp b/llvm/unittests/Support/FSUniqueIDTest.cpp
--- a/llvm/unittests/Support/FSUniqueIDTest.cpp
+++ b/llvm/unittests/Support/FSUniqueIDTest.cpp
@@ -20,9 +20,9 @@
}
TEST(FSUniqueIDTest, equals) {
- EXPECT_TRUE(UniqueID(20, 10) == UniqueID(20, 10));
- EXPECT_FALSE(UniqueID(20, 20) == UniqueID(20, 10));
- EXPECT_FALSE(UniqueID(10, 10) == UniqueID(20, 10));
+ EXPECT_EQ(UniqueID(20, 10), UniqueID(20, 10));
+ EXPECT_NE(UniqueID(20, 20), UniqueID(20, 10));
+ EXPECT_NE(UniqueID(10, 10), UniqueID(20, 10));
}
TEST(FSUniqueIDTest, less) {
diff --git a/llvm/unittests/Support/IndexedAccessorTest.cpp b/llvm/unittests/Support/IndexedAccessorTest.cpp
--- a/llvm/unittests/Support/IndexedAccessorTest.cpp
+++ b/llvm/unittests/Support/IndexedAccessorTest.cpp
@@ -32,7 +32,7 @@
template
static void compareData(ArrayIndexedAccessorRange range,
ArrayRef referenceData) {
- ASSERT_TRUE(referenceData.size() == range.size());
+ ASSERT_EQ(referenceData.size(), range.size());
ASSERT_TRUE(std::equal(range.begin(), range.end(), referenceData.begin()));
}
diff --git a/llvm/unittests/Support/JSONTest.cpp b/llvm/unittests/Support/JSONTest.cpp
--- a/llvm/unittests/Support/JSONTest.cpp
+++ b/llvm/unittests/Support/JSONTest.cpp
@@ -138,9 +138,9 @@
EXPECT_FALSE(O.try_emplace("a", 4).second);
auto D = O.find("d");
- EXPECT_FALSE(D == O.end());
+ EXPECT_NE(D, O.end());
auto E = O.find("e");
- EXPECT_TRUE(E == O.end());
+ EXPECT_EQ(E, O.end());
O.erase("b");
O.erase(D);
diff --git a/llvm/unittests/Support/MemoryBufferTest.cpp b/llvm/unittests/Support/MemoryBufferTest.cpp
--- a/llvm/unittests/Support/MemoryBufferTest.cpp
+++ b/llvm/unittests/Support/MemoryBufferTest.cpp
@@ -75,15 +75,15 @@
TEST_F(MemoryBufferTest, get) {
// Default name and null-terminator flag
OwningBuffer MB1(MemoryBuffer::getMemBuffer(data));
- EXPECT_TRUE(nullptr != MB1.get());
+ EXPECT_NE(nullptr, MB1.get());
// RequiresNullTerminator = false
OwningBuffer MB2(MemoryBuffer::getMemBuffer(data, "one", false));
- EXPECT_TRUE(nullptr != MB2.get());
+ EXPECT_NE(nullptr, MB2.get());
// RequiresNullTerminator = true
OwningBuffer MB3(MemoryBuffer::getMemBuffer(data, "two", true));
- EXPECT_TRUE(nullptr != MB3.get());
+ EXPECT_NE(nullptr, MB3.get());
// verify all 3 buffers point to the same address
EXPECT_EQ(MB1->getBufferStart(), MB2->getBufferStart());
@@ -153,11 +153,11 @@
TEST_F(MemoryBufferTest, copy) {
// copy with no name
OwningBuffer MBC1(MemoryBuffer::getMemBufferCopy(data));
- EXPECT_TRUE(nullptr != MBC1.get());
+ EXPECT_NE(nullptr, MBC1.get());
// copy with a name
OwningBuffer MBC2(MemoryBuffer::getMemBufferCopy(data, "copy"));
- EXPECT_TRUE(nullptr != MBC2.get());
+ EXPECT_NE(nullptr, MBC2.get());
// verify the two copies do not point to the same place
EXPECT_NE(MBC1->getBufferStart(), MBC2->getBufferStart());
@@ -198,25 +198,25 @@
TEST_F(MemoryBufferTest, make_new) {
// 0-sized buffer
OwningBuffer Zero(WritableMemoryBuffer::getNewUninitMemBuffer(0));
- EXPECT_TRUE(nullptr != Zero.get());
+ EXPECT_NE(nullptr, Zero.get());
// uninitialized buffer with no name
OwningBuffer One(WritableMemoryBuffer::getNewUninitMemBuffer(321));
- EXPECT_TRUE(nullptr != One.get());
+ EXPECT_NE(nullptr, One.get());
// uninitialized buffer with name
OwningBuffer Two(WritableMemoryBuffer::getNewUninitMemBuffer(123, "bla"));
- EXPECT_TRUE(nullptr != Two.get());
+ EXPECT_NE(nullptr, Two.get());
// 0-initialized buffer with no name
OwningBuffer Three(WritableMemoryBuffer::getNewMemBuffer(321, data));
- EXPECT_TRUE(nullptr != Three.get());
+ EXPECT_NE(nullptr, Three.get());
for (size_t i = 0; i < 321; ++i)
EXPECT_EQ(0, Three->getBufferStart()[0]);
// 0-initialized buffer with name
OwningBuffer Four(WritableMemoryBuffer::getNewMemBuffer(123, "zeros"));
- EXPECT_TRUE(nullptr != Four.get());
+ EXPECT_NE(nullptr, Four.get());
for (size_t i = 0; i < 123; ++i)
EXPECT_EQ(0, Four->getBufferStart()[0]);
}
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -2315,7 +2315,7 @@
for (size_t i = 0; i < NumChars; ++i)
Input += Pi;
// Check that UTF-8 length already exceeds MAX_PATH.
- EXPECT_TRUE(Input.size() > MAX_PATH);
+ EXPECT_GT(Input.size(), MAX_PATH);
SmallVector Result;
ASSERT_NO_ERROR(windows::widenPath(Input, Result));
// Result should not start with the long path prefix.
diff --git a/llvm/unittests/Support/ProgramTest.cpp b/llvm/unittests/Support/ProgramTest.cpp
--- a/llvm/unittests/Support/ProgramTest.cpp
+++ b/llvm/unittests/Support/ProgramTest.cpp
@@ -287,8 +287,8 @@
bool ExecutionFailed;
int RetCode = ExecuteAndWait(Executable, argv, llvm::None, {}, 0, 0, &Error,
&ExecutionFailed);
- ASSERT_TRUE(RetCode < 0) << "On error ExecuteAndWait should return 0 or "
- "positive value indicating the result code";
+ ASSERT_LT(RetCode, 0) << "On error ExecuteAndWait should return 0 or "
+ "positive value indicating the result code";
ASSERT_TRUE(ExecutionFailed);
ASSERT_FALSE(Error.empty());
}
diff --git a/llvm/unittests/Support/TarWriterTest.cpp b/llvm/unittests/Support/TarWriterTest.cpp
--- a/llvm/unittests/Support/TarWriterTest.cpp
+++ b/llvm/unittests/Support/TarWriterTest.cpp
@@ -68,7 +68,7 @@
static UstarHeader createUstar(StringRef Base, StringRef Filename) {
std::vector Buf = createTar(Base, Filename);
- EXPECT_TRUE(Buf.size() >= sizeof(UstarHeader));
+ EXPECT_GE(Buf.size(), sizeof(UstarHeader));
return *reinterpret_cast(Buf.data());
}
@@ -112,7 +112,7 @@
TEST_F(TarWriterTest, Pax) {
std::vector Buf = createTar("", std::string(200, 'x'));
- EXPECT_TRUE(Buf.size() >= 1024);
+ EXPECT_GE(Buf.size(), 1024u);
auto *Hdr = reinterpret_cast(Buf.data());
EXPECT_EQ("", StringRef(Hdr->Prefix));
diff --git a/llvm/unittests/Support/TargetParserTest.cpp b/llvm/unittests/Support/TargetParserTest.cpp
--- a/llvm/unittests/Support/TargetParserTest.cpp
+++ b/llvm/unittests/Support/TargetParserTest.cpp
@@ -687,13 +687,13 @@
Features.clear();
ARM::getExtensionFeatures(E.first, Features);
EXPECT_TRUE(llvm::is_contained(Features, E.second.at(0)));
- EXPECT_TRUE(Extensions.size() == Features.size());
+ EXPECT_EQ(Extensions.size(), Features.size());
// test -extension
Features.clear();
ARM::getExtensionFeatures(~E.first, Features);
EXPECT_TRUE(llvm::is_contained(Features, E.second.at(1)));
- EXPECT_TRUE(Extensions.size() == Features.size());
+ EXPECT_EQ(Extensions.size(), Features.size());
}
}
@@ -701,10 +701,12 @@
std::vector Features;
for (ARM::FPUKind FK = static_cast(0);
FK <= ARM::FPUKind::FK_LAST;
- FK = static_cast(static_cast(FK) + 1))
- EXPECT_TRUE((FK == ARM::FK_INVALID || FK >= ARM::FK_LAST)
- ? !ARM::getFPUFeatures(FK, Features)
- : ARM::getFPUFeatures(FK, Features));
+ FK = static_cast(static_cast(FK) + 1)) {
+ if (FK == ARM::FK_INVALID || FK >= ARM::FK_LAST)
+ EXPECT_FALSE(ARM::getFPUFeatures(FK, Features));
+ else
+ EXPECT_TRUE(ARM::getFPUFeatures(FK, Features));
+ }
}
TEST(TargetParserTest, ARMArchExtFeature) {
@@ -1448,7 +1450,7 @@
EXPECT_TRUE(!Features.size());
AArch64::getExtensionFeatures(ExtVal, Features);
- EXPECT_TRUE(Extensions.size() == Features.size());
+ EXPECT_EQ(Extensions.size(), Features.size());
EXPECT_TRUE(llvm::is_contained(Features, "+crc"));
EXPECT_TRUE(llvm::is_contained(Features, "+crypto"));
@@ -1477,10 +1479,12 @@
TEST(TargetParserTest, AArch64ArchFeatures) {
std::vector Features;
- for (auto AK : AArch64::ArchKinds)
- EXPECT_TRUE((AK == AArch64::ArchKind::INVALID)
- ? !AArch64::getArchFeatures(AK, Features)
- : AArch64::getArchFeatures(AK, Features));
+ for (auto AK : AArch64::ArchKinds) {
+ if (AK == AArch64::ArchKind::INVALID)
+ EXPECT_FALSE(AArch64::getArchFeatures(AK, Features));
+ else
+ EXPECT_TRUE(AArch64::getArchFeatures(AK, Features));
+ }
}
TEST(TargetParserTest, AArch64ArchExtFeature) {
diff --git a/llvm/unittests/Support/TimerTest.cpp b/llvm/unittests/Support/TimerTest.cpp
--- a/llvm/unittests/Support/TimerTest.cpp
+++ b/llvm/unittests/Support/TimerTest.cpp
@@ -45,7 +45,7 @@
T1.stopTimer();
auto TR2 = T1.getTotalTime();
- EXPECT_TRUE(TR1 < TR2);
+ EXPECT_LT(TR1, TR2);
}
TEST(Timer, CheckIfTriggered) {
diff --git a/llvm/unittests/Support/UnicodeTest.cpp b/llvm/unittests/Support/UnicodeTest.cpp
--- a/llvm/unittests/Support/UnicodeTest.cpp
+++ b/llvm/unittests/Support/UnicodeTest.cpp
@@ -95,9 +95,9 @@
UTF32 *Target32 = &buf32[0];
auto status = ConvertUTF8toUTF32(&Target8, Target8 + 1, &Target32,
Target32 + 1, strictConversion);
- EXPECT_TRUE(status == conversionOK);
- EXPECT_TRUE((columnWidthUTF8(reinterpret_cast(buf8)) == 1) ==
- (bool)isPrintable(buf32[0]));
+ EXPECT_EQ(status, conversionOK);
+ EXPECT_EQ((columnWidthUTF8(reinterpret_cast(buf8)) == 1),
+ (bool)isPrintable(buf32[0]));
}
}
diff --git a/llvm/unittests/Support/VirtualFileSystemTest.cpp b/llvm/unittests/Support/VirtualFileSystemTest.cpp
--- a/llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ b/llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -567,7 +567,8 @@
for (const std::string &Name : Contents) {
ASSERT_FALSE(Name.empty());
int Index = Name[Name.size() - 1] - 'a';
- ASSERT_TRUE(Index >= 0 && Index < 4);
+ ASSERT_GE(Index, 0);
+ ASSERT_LT(Index, 4);
Counts[Index]++;
}
EXPECT_EQ(1, Counts[0]); // a
@@ -644,7 +645,8 @@
for (const std::string &Name : Contents) {
ASSERT_FALSE(Name.empty());
int Index = Name[Name.size() - 1] - 'a';
- ASSERT_TRUE(Index >= 0 && Index < 7);
+ ASSERT_GE(Index, 0);
+ ASSERT_LT(Index, 7);
Counts[Index]++;
}
EXPECT_EQ(1, Counts[0]); // a
@@ -1183,9 +1185,9 @@
FS.addFile(Target, 0, MemoryBuffer::getMemBuffer("content of target"));
EXPECT_TRUE(FS.addHardLink(FromLink, Target));
EXPECT_THAT(FromLink, IsHardLinkTo(&FS, Target));
- EXPECT_TRUE(FS.status(FromLink)->getSize() == FS.status(Target)->getSize());
- EXPECT_TRUE(FS.getBufferForFile(FromLink)->get()->getBuffer() ==
- FS.getBufferForFile(Target)->get()->getBuffer());
+ EXPECT_EQ(FS.status(FromLink)->getSize(), FS.status(Target)->getSize());
+ EXPECT_EQ(FS.getBufferForFile(FromLink)->get()->getBuffer(),
+ FS.getBufferForFile(Target)->get()->getBuffer());
}
TEST_F(InMemoryFileSystemTest, AddHardLinkInChainPattern) {
@@ -1381,7 +1383,7 @@
"]\n"
"}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
IntrusiveRefCntPtr O(
new vfs::OverlayFileSystem(Lower));
@@ -1474,7 +1476,7 @@
"]\n"
"}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
IntrusiveRefCntPtr O(
new vfs::OverlayFileSystem(Lower));
@@ -1522,7 +1524,7 @@
" ]\n"
"}]}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
IntrusiveRefCntPtr O(
new vfs::OverlayFileSystem(Lower));
@@ -1567,7 +1569,7 @@
" ]\n"
"}]}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
ErrorOr S = FS->status("//root/foo");
ASSERT_FALSE(S.getError());
@@ -1608,7 +1610,7 @@
" ]\n"
"}]}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
ErrorOr S = Lower->status("//root/foo");
ASSERT_FALSE(S.getError());
@@ -1752,7 +1754,7 @@
" ]\n"
"}]}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
IntrusiveRefCntPtr O(
new vfs::OverlayFileSystem(Lower));
@@ -1788,7 +1790,7 @@
" ]\n"
"}]}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
IntrusiveRefCntPtr O(
new vfs::OverlayFileSystem(Lower));
@@ -1930,7 +1932,7 @@
" }\n"
"] }",
Lower);
- ASSERT_TRUE(nullptr != FS.get());
+ ASSERT_NE(nullptr, FS.get());
// default true
EXPECT_EQ("//root/external/file", FS->status("//root/A")->getName());
@@ -1954,7 +1956,7 @@
" }\n"
"] }",
Lower);
- ASSERT_TRUE(nullptr != FS.get());
+ ASSERT_NE(nullptr, FS.get());
// default
EXPECT_EQ("//root/A", FS->status("//root/A")->getName());
@@ -1974,7 +1976,7 @@
" 'external-contents': '//root/other' }]\n"
"}",
Lower);
- ASSERT_TRUE(nullptr != FS.get());
+ ASSERT_NE(nullptr, FS.get());
EXPECT_FALSE(FS->status("//root/path/to/file").getError());
EXPECT_FALSE(FS->status("//root/path/to").getError());
EXPECT_FALSE(FS->status("//root/path").getError());
@@ -1988,7 +1990,7 @@
" 'external-contents': '//root/other' }]}]\n"
"}",
Lower);
- ASSERT_TRUE(nullptr != FS.get());
+ ASSERT_NE(nullptr, FS.get());
EXPECT_FALSE(FS->status("//root/path/to/file").getError());
EXPECT_FALSE(FS->status("//root/path/to").getError());
EXPECT_FALSE(FS->status("//root/path").getError());
@@ -2002,7 +2004,7 @@
" 'external-contents': '//root/other' }]}]\n"
"}",
Lower);
- ASSERT_TRUE(nullptr != FS.get());
+ ASSERT_NE(nullptr, FS.get());
EXPECT_FALSE(FS->status("//root/path/to/file").getError());
EXPECT_FALSE(FS->status("//root/path/to").getError());
EXPECT_FALSE(FS->status("//root/path").getError());
@@ -2021,7 +2023,7 @@
" 'external-contents': '//root/other' }]}]\n"
"}",
Lower);
- ASSERT_TRUE(nullptr != FS.get());
+ ASSERT_NE(nullptr, FS.get());
EXPECT_FALSE(FS->status("//root/path/to/file").getError());
EXPECT_FALSE(FS->status("//root/path/to").getError());
EXPECT_FALSE(FS->status("//root/path").getError());
@@ -2057,7 +2059,7 @@
"]\n"
"}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
IntrusiveRefCntPtr O(
new vfs::OverlayFileSystem(Lower));
@@ -2107,7 +2109,7 @@
"]\n"
"}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
IntrusiveRefCntPtr O(
new vfs::OverlayFileSystem(Lower));
@@ -2142,7 +2144,7 @@
"]\n"
"}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
IntrusiveRefCntPtr O(
new vfs::OverlayFileSystem(Lower));
@@ -2238,7 +2240,7 @@
"]\n"
"}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
std::error_code EC;
checkContents(FS->dir_begin("//root/", EC),
@@ -2266,7 +2268,7 @@
"]\n"
"}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
std::error_code EC;
checkContents(FS->dir_begin("//root/", EC),
@@ -2295,7 +2297,7 @@
"]\n"
"}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
std::error_code EC;
checkContents(FS->dir_begin("//root/foo", EC),
@@ -2328,7 +2330,7 @@
"]\n"
"}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
// Regular file present in underlying file system.
SmallString<16> RealPath;
@@ -2370,7 +2372,7 @@
"]\n"
"}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
std::error_code EC = FS->setCurrentWorkingDirectory("//root/bar");
ASSERT_FALSE(EC);
@@ -2439,10 +2441,10 @@
"]\n"
"}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
std::error_code EC = FS->setCurrentWorkingDirectory("//root/");
ASSERT_FALSE(EC);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
llvm::ErrorOr Status = FS->status("bar/a");
ASSERT_FALSE(Status.getError());
@@ -2511,10 +2513,10 @@
"]\n"
"}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
std::error_code EC = FS->setCurrentWorkingDirectory("//root/");
ASSERT_FALSE(EC);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
llvm::ErrorOr Status = FS->status("bar/a");
ASSERT_FALSE(Status.getError());
@@ -2548,10 +2550,10 @@
"]\n"
"}",
Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
std::error_code EC = FS->setCurrentWorkingDirectory("//root/bar");
ASSERT_FALSE(EC);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
llvm::ErrorOr Status = FS->status("a");
ASSERT_FALSE(Status.getError());
@@ -2596,7 +2598,7 @@
Lower->addDirectory("//root/h");
IntrusiveRefCntPtr FS = getFromYAMLRawString(Buffer, Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
EXPECT_TRUE(FS->exists(_a.path()));
EXPECT_TRUE(FS->exists(_ab.path()));
@@ -2636,7 +2638,7 @@
IntrusiveRefCntPtr Lower(new ErrorDummyFileSystem());
IntrusiveRefCntPtr FS = getFromYAMLRawString(Buffer, Lower);
- EXPECT_TRUE(FS.get() != nullptr);
+ EXPECT_NE(FS.get(), nullptr);
}
TEST_F(VFSFromYAMLTest, YAMLVFSWriterTest3) {
@@ -2669,7 +2671,7 @@
IntrusiveRefCntPtr Lower(new ErrorDummyFileSystem());
IntrusiveRefCntPtr FS = getFromYAMLRawString(Buffer, Lower);
- EXPECT_TRUE(FS.get() != nullptr);
+ EXPECT_NE(FS.get(), nullptr);
}
TEST_F(VFSFromYAMLTest, YAMLVFSWriterTestHandleDirs) {
@@ -2689,7 +2691,7 @@
OS.flush();
// We didn't add a single file - only directories.
- EXPECT_TRUE(Buffer.find("'type': 'file'") == std::string::npos);
+ EXPECT_EQ(Buffer.find("'type': 'file'"), std::string::npos);
IntrusiveRefCntPtr Lower(new ErrorDummyFileSystem());
Lower->addDirectory("//root/a");
@@ -2701,7 +2703,7 @@
Lower->addRegularFile("//root/c/c");
IntrusiveRefCntPtr FS = getFromYAMLRawString(Buffer, Lower);
- ASSERT_TRUE(FS.get() != nullptr);
+ ASSERT_NE(FS.get(), nullptr);
EXPECT_FALSE(FS->exists(_a.path("a")));
EXPECT_FALSE(FS->exists(_b.path("b")));
diff --git a/llvm/unittests/Support/YAMLIOTest.cpp b/llvm/unittests/Support/YAMLIOTest.cpp
--- a/llvm/unittests/Support/YAMLIOTest.cpp
+++ b/llvm/unittests/Support/YAMLIOTest.cpp
@@ -398,8 +398,8 @@
yin >> map;
EXPECT_FALSE(yin.error());
- EXPECT_TRUE(map.str.equals("hello there"));
- EXPECT_TRUE(map.stdstr == "hello where?");
+ EXPECT_EQ(map.str, "hello there");
+ EXPECT_EQ(map.stdstr, "hello where?");
EXPECT_EQ(map.u64, 5000000000ULL);
EXPECT_EQ(map.u32, 4000000000U);
EXPECT_EQ(map.u16, 65000);
@@ -454,23 +454,23 @@
yin >> map;
EXPECT_FALSE(yin.error());
- EXPECT_TRUE(map.str.equals("one two"));
- EXPECT_TRUE(map.stdstr == "three four");
- EXPECT_EQ(map.u64, 6000000000ULL);
- EXPECT_EQ(map.u32, 3000000000U);
- EXPECT_EQ(map.u16, 50000);
- EXPECT_EQ(map.u8, 254);
- EXPECT_EQ(map.b, true);
- EXPECT_EQ(map.s64, -6000000000LL);
- EXPECT_EQ(map.s32, -2000000000L);
- EXPECT_EQ(map.s16, -32000);
- EXPECT_EQ(map.s8, -128);
- EXPECT_EQ(map.f, 3.25);
- EXPECT_EQ(map.d, -2.8625);
- EXPECT_EQ(map.h8, Hex8(254));
- EXPECT_EQ(map.h16, Hex16(50000));
- EXPECT_EQ(map.h32, Hex32(3000000000U));
- EXPECT_EQ(map.h64, Hex64(6000000000LL));
+ EXPECT_EQ(map.str, "one two");
+ EXPECT_EQ(map.stdstr, "three four");
+ EXPECT_EQ(map.u64, 6000000000ULL);
+ EXPECT_EQ(map.u32, 3000000000U);
+ EXPECT_EQ(map.u16, 50000);
+ EXPECT_EQ(map.u8, 254);
+ EXPECT_EQ(map.b, true);
+ EXPECT_EQ(map.s64, -6000000000LL);
+ EXPECT_EQ(map.s32, -2000000000L);
+ EXPECT_EQ(map.s16, -32000);
+ EXPECT_EQ(map.s8, -128);
+ EXPECT_EQ(map.f, 3.25);
+ EXPECT_EQ(map.d, -2.8625);
+ EXPECT_EQ(map.h8, Hex8(254));
+ EXPECT_EQ(map.h16, Hex16(50000));
+ EXPECT_EQ(map.h32, Hex32(3000000000U));
+ EXPECT_EQ(map.h64, Hex64(6000000000LL));
}
}
@@ -785,18 +785,18 @@
yin >> map;
EXPECT_FALSE(yin.error());
- EXPECT_TRUE(map.str1.equals("'aaa"));
- EXPECT_TRUE(map.str2.equals("\"bbb"));
- EXPECT_TRUE(map.str3.equals("`ccc"));
- EXPECT_TRUE(map.str4.equals("@ddd"));
- EXPECT_TRUE(map.str5.equals(""));
- EXPECT_TRUE(map.str6.equals("0000000004000000"));
- EXPECT_TRUE(map.stdstr1 == "'eee");
- EXPECT_TRUE(map.stdstr2 == "\"fff");
- EXPECT_TRUE(map.stdstr3 == "`ggg");
- EXPECT_TRUE(map.stdstr4 == "@hhh");
- EXPECT_TRUE(map.stdstr5 == "");
- EXPECT_TRUE(map.stdstr6 == "0000000004000000");
+ EXPECT_EQ(map.str1, "'aaa");
+ EXPECT_EQ(map.str2, "\"bbb");
+ EXPECT_EQ(map.str3, "`ccc");
+ EXPECT_EQ(map.str4, "@ddd");
+ EXPECT_EQ(map.str5, "");
+ EXPECT_EQ(map.str6, "0000000004000000");
+ EXPECT_EQ(map.stdstr1, "'eee");
+ EXPECT_EQ(map.stdstr2, "\"fff");
+ EXPECT_EQ(map.stdstr3, "`ggg");
+ EXPECT_EQ(map.stdstr4, "@hhh");
+ EXPECT_EQ(map.stdstr5, "");
+ EXPECT_EQ(map.stdstr6, "0000000004000000");
EXPECT_EQ(std::string("\0a\0b\0", 5), map.stdstr13);
}
}
@@ -2208,10 +2208,10 @@
yin2 >> seq2;
EXPECT_TRUE(!!yin2.error());
- EXPECT_TRUE(seq.size() == 3);
- EXPECT_TRUE(seq.size() == seq2.size());
+ EXPECT_EQ(seq.size(), 3u);
+ EXPECT_EQ(seq.size(), seq2.size());
for (size_t i = 0; i < seq.size(); ++i)
- EXPECT_TRUE(seq[i] == seq2[i]);
+ EXPECT_EQ(seq[i], seq2[i]);
}
@@ -2238,10 +2238,10 @@
yin2 >> seq2;
EXPECT_TRUE(!!yin2.error());
- EXPECT_TRUE(seq.size() == 3);
- EXPECT_TRUE(seq.size() == seq2.size());
+ EXPECT_EQ(seq.size(), 3u);
+ EXPECT_EQ(seq.size(), seq2.size());
for (size_t i = 0; i < seq.size(); ++i)
- EXPECT_TRUE(seq[i] == seq2[i]);
+ EXPECT_EQ(seq[i], seq2[i]);
}
//
@@ -2268,10 +2268,10 @@
yin2 >> seq2;
EXPECT_TRUE(!!yin2.error());
- EXPECT_TRUE(seq.size() == 3);
- EXPECT_TRUE(seq.size() == seq2.size());
+ EXPECT_EQ(seq.size(), 3u);
+ EXPECT_EQ(seq.size(), seq2.size());
for (size_t i = 0; i < seq.size(); ++i)
- EXPECT_TRUE(seq[i] == seq2[i]);
+ EXPECT_EQ(seq[i], seq2[i]);
}
//
@@ -2297,10 +2297,10 @@
yin2 >> seq2;
EXPECT_TRUE(!!yin2.error());
- EXPECT_TRUE(seq.size() == 3);
- EXPECT_TRUE(seq.size() == seq2.size());
+ EXPECT_EQ(seq.size(), 3u);
+ EXPECT_EQ(seq.size(), seq2.size());
for (size_t i = 0; i < seq.size(); ++i)
- EXPECT_TRUE(seq[i] == seq2[i]);
+ EXPECT_EQ(seq[i], seq2[i]);
}
TEST(YAMLIO, TestMalformedMapFailsGracefully) {
diff --git a/llvm/unittests/Support/YAMLParserTest.cpp b/llvm/unittests/Support/YAMLParserTest.cpp
--- a/llvm/unittests/Support/YAMLParserTest.cpp
+++ b/llvm/unittests/Support/YAMLParserTest.cpp
@@ -269,9 +269,9 @@
auto Begin = Node->begin();
auto End = Node->end();
- EXPECT_TRUE(Begin != End);
- EXPECT_FALSE(Begin != Begin);
- EXPECT_FALSE(End != End);
+ EXPECT_NE(Begin, End);
+ EXPECT_EQ(Begin, Begin);
+ EXPECT_EQ(End, End);
}
TEST(YAMLParser, SameNodeIteratorOperatorEquals) {
@@ -284,9 +284,9 @@
auto Begin = Node->begin();
auto End = Node->end();
- EXPECT_FALSE(Begin == End);
- EXPECT_TRUE(Begin == Begin);
- EXPECT_TRUE(End == End);
+ EXPECT_NE(Begin, End);
+ EXPECT_EQ(Begin, Begin);
+ EXPECT_EQ(End, End);
}
TEST(YAMLParser, DifferentNodesIteratorOperatorNotEquals) {
@@ -305,9 +305,9 @@
auto AnotherBegin = AnotherNode->begin();
auto AnotherEnd = AnotherNode->end();
- EXPECT_TRUE(Begin != AnotherBegin);
- EXPECT_TRUE(Begin != AnotherEnd);
- EXPECT_FALSE(End != AnotherEnd);
+ EXPECT_NE(Begin, AnotherBegin);
+ EXPECT_NE(Begin, AnotherEnd);
+ EXPECT_EQ(End, AnotherEnd);
}
TEST(YAMLParser, DifferentNodesIteratorOperatorEquals) {
@@ -326,9 +326,9 @@
auto AnotherBegin = AnotherNode->begin();
auto AnotherEnd = AnotherNode->end();
- EXPECT_FALSE(Begin == AnotherBegin);
- EXPECT_FALSE(Begin == AnotherEnd);
- EXPECT_TRUE(End == AnotherEnd);
+ EXPECT_NE(Begin, AnotherBegin);
+ EXPECT_NE(Begin, AnotherEnd);
+ EXPECT_EQ(End, AnotherEnd);
}
TEST(YAMLParser, FlowSequenceTokensOutsideFlowSequence) {
diff --git a/llvm/unittests/Support/raw_ostream_test.cpp b/llvm/unittests/Support/raw_ostream_test.cpp
--- a/llvm/unittests/Support/raw_ostream_test.cpp
+++ b/llvm/unittests/Support/raw_ostream_test.cpp
@@ -469,7 +469,7 @@
OS << "11111111111111111111";
uint64_t CurrentPos = OS.tell();
OS.reserveExtraSpace(1000);
- EXPECT_TRUE(Str.capacity() >= CurrentPos + 1000);
+ EXPECT_GE(Str.capacity(), CurrentPos + 1000);
OS << "hello";
OS << 1;
OS << 'w' << 'o' << 'r' << 'l' << 'd';