Commit fc882313 authored by JINMEI Tatuya's avatar JINMEI Tatuya Committed by Mukund Sivaraman
Browse files

[2432] use EXPECT_TRUE and ==/!= instead of EXPECT_EQ/NE iterators

the latter doesn't always work.
parent 82d0b7f2
...@@ -129,7 +129,7 @@ doAddAndRemove(RRsetCollection& collection, const RRClass& rrclass) { ...@@ -129,7 +129,7 @@ doAddAndRemove(RRsetCollection& collection, const RRClass& rrclass) {
EXPECT_EQ(Name("foo.example.org"), rrset_found->getName()); EXPECT_EQ(Name("foo.example.org"), rrset_found->getName());
// The collection must not be empty. // The collection must not be empty.
EXPECT_NE(collection.end(), collection.begin()); EXPECT_TRUE(collection.end() != collection.begin());
// Adding a duplicate RRset must throw. // Adding a duplicate RRset must throw.
EXPECT_THROW({ EXPECT_THROW({
...@@ -153,18 +153,18 @@ TEST_F(RRsetCollectionTest, empty) { ...@@ -153,18 +153,18 @@ TEST_F(RRsetCollectionTest, empty) {
RRsetCollection cln; RRsetCollection cln;
// Here, cln is empty. // Here, cln is empty.
EXPECT_EQ(cln.end(), cln.begin()); EXPECT_TRUE(cln.end() == cln.begin());
doAddAndRemove(cln, rrclass); doAddAndRemove(cln, rrclass);
// cln should be empty again here, after the add and remove // cln should be empty again here, after the add and remove
// operations. // operations.
EXPECT_EQ(cln.end(), cln.begin()); EXPECT_TRUE(cln.end() == cln.begin());
} }
TEST_F(RRsetCollectionTest, iteratorTest) { TEST_F(RRsetCollectionTest, iteratorTest) {
// The collection must not be empty. // The collection must not be empty.
EXPECT_NE(collection.end(), collection.begin()); EXPECT_TRUE(collection.end() != collection.begin());
// Here, we just count the records and do some basic tests on them. // Here, we just count the records and do some basic tests on them.
size_t count = 0; size_t count = 0;
...@@ -249,8 +249,8 @@ TEST_F(RRsetCollectionTest, iteratorCompareDifferent) { ...@@ -249,8 +249,8 @@ TEST_F(RRsetCollectionTest, iteratorCompareDifferent) {
// Comparing two iterators from different RRsetCollectionBase // Comparing two iterators from different RRsetCollectionBase
// implementations must not throw. // implementations must not throw.
EXPECT_NE(cln2.begin(), cln1.begin()); EXPECT_TRUE(cln2.begin() != cln1.begin());
EXPECT_NE(cln1.end(), cln2.end()); EXPECT_TRUE(cln1.end() != cln2.end());
} }
} // namespace } // namespace
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment