summaryrefslogtreecommitdiff
path: root/test/libapt/strutil_test.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2018-05-04 18:24:57 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2018-05-04 18:42:37 +0200
commit1d77c915005f7630949e2ce706055ee3235009b6 (patch)
treed10b246f29198a4085e2923a53e4d8bafff73bcc /test/libapt/strutil_test.cc
parent39d9e217a22901892647499ee695ba472a111d25 (diff)
Prevent GTest from flooding us with compiler warnings
GTest has a bunch of undefined macros which causes the compiler to spit out warnings for each one on each test file. There isn't much we can do, so we just disable the warning for the testcases. Other warnings like sign-promo and sign-compare we can avoid by being more explicit about our expected integer constants being unsigned. As we are just changing testcases, there is no user visible change which would deserve to be noted in the changelog. Gbp-Dch: Ignore Reported-By: gcc-8
Diffstat (limited to 'test/libapt/strutil_test.cc')
-rw-r--r--test/libapt/strutil_test.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc
index f531c2bf9..5cb6cb9ff 100644
--- a/test/libapt/strutil_test.cc
+++ b/test/libapt/strutil_test.cc
@@ -40,21 +40,21 @@ TEST(StrUtilTest,StringStrip)
TEST(StrUtilTest,StringSplitBasic)
{
std::vector<std::string> result = StringSplit("", "");
- EXPECT_EQ(result.size(), 0);
+ EXPECT_TRUE(result.empty());
result = StringSplit("abc", "");
- EXPECT_EQ(result.size(), 0);
+ EXPECT_TRUE(result.empty());
result = StringSplit("", "abc");
- EXPECT_EQ(result.size(), 1);
+ EXPECT_EQ(result.size(), 1u);
result = StringSplit("abc", "b");
- ASSERT_EQ(result.size(), 2);
+ ASSERT_EQ(result.size(), 2u);
EXPECT_EQ(result[0], "a");
EXPECT_EQ(result[1], "c");
result = StringSplit("abc", "abc");
- ASSERT_EQ(result.size(), 2);
+ ASSERT_EQ(result.size(), 2u);
EXPECT_EQ(result[0], "");
EXPECT_EQ(result[1], "");
}
@@ -62,20 +62,20 @@ TEST(StrUtilTest,StringSplitDpkgStatus)
{
std::string const input = "status: libnet1:amd64: unpacked";
std::vector<std::string> result = StringSplit(input, "xxx");
- ASSERT_EQ(result.size(), 1);
+ ASSERT_EQ(result.size(), 1u);
EXPECT_EQ(result[0], input);
result = StringSplit(input, "");
- EXPECT_EQ(result.size(), 0);
+ EXPECT_TRUE(result.empty());
result = StringSplit(input, ": ");
- ASSERT_EQ(result.size(), 3);
+ ASSERT_EQ(result.size(), 3u);
EXPECT_EQ(result[0], "status");
EXPECT_EQ(result[1], "libnet1:amd64");
EXPECT_EQ(result[2], "unpacked");
result = StringSplit("x:y:z", ":", 2);
- ASSERT_EQ(result.size(), 2);
+ ASSERT_EQ(result.size(), 2u);
EXPECT_EQ(result[0], "x");
EXPECT_EQ(result[1], "y:z");
}
@@ -190,7 +190,7 @@ static void ReadMessagesTestWithNewLine(char const * const nl, char const * cons
createTemporaryFile("readmessage", fd, NULL, (pkgA + nl + pkgB + nl + pkgC + nl).c_str());
std::vector<std::string> list;
EXPECT_TRUE(ReadMessages(fd.Fd(), list));
- EXPECT_EQ(3, list.size());
+ EXPECT_EQ(3u, list.size());
EXPECT_EQ(pkgA, list[0]);
EXPECT_EQ(pkgB, list[1]);
EXPECT_EQ(pkgC, list[2]);
@@ -210,7 +210,7 @@ static void ReadMessagesTestWithNewLine(char const * const nl, char const * cons
fd.Seek(0);
list.clear();
EXPECT_TRUE(ReadMessages(fd.Fd(), list));
- EXPECT_EQ(1, list.size());
+ EXPECT_EQ(1u, list.size());
EXPECT_EQ((msgsize + i) * strlen(ab), list[0].length());
EXPECT_EQ(std::string::npos, list[0].find_first_not_of(ab));
}
@@ -220,7 +220,7 @@ static void ReadMessagesTestWithNewLine(char const * const nl, char const * cons
fd.Write(nl, strlen(nl));
fd.Seek(0);
EXPECT_TRUE(ReadMessages(fd.Fd(), list));
- EXPECT_EQ(2, list.size());
+ EXPECT_EQ(2u, list.size());
EXPECT_EQ((msgsize + 20) * strlen(ab), list[0].length());
EXPECT_EQ(std::string::npos, list[0].find_first_not_of(ab));
EXPECT_EQ(pkgA, list[1]);