Browse Source

[1975] use EXPECT_TRUE with == inside it, instead of EXPECT_EQ to make it build.

Since no operator<< for SearchResult is defined, EXPECT_EQ doesn't compile,
at least not on some environment.  This is not the only way to fix it, but
reviewing it without having buildable tree is quite difficult, so I'm
tentatively making the easiest fix and committing it.  Feel free to override
it.
JINMEI Tatuya 13 years ago
parent
commit
88cbe7028f
1 changed files with 19 additions and 16 deletions
  1. 19 16
      src/lib/datasrc/tests/container_unittest.cc

+ 19 - 16
src/lib/datasrc/tests/container_unittest.cc

@@ -252,14 +252,17 @@ TEST_F(ContainerTest, emptyContainer) {
 // match.
 TEST_F(ContainerTest, emptySearch) {
     // No matter what we try, we don't get an answer.
-    EXPECT_EQ(negativeResult_, container_->search(Name("example.org"), false,
-                                                 false));
-    EXPECT_EQ(negativeResult_, container_->search(Name("example.org"), false,
-                                                 true));
-    EXPECT_EQ(negativeResult_, container_->search(Name("example.org"), true,
-                                                 false));
-    EXPECT_EQ(negativeResult_, container_->search(Name("example.org"), true,
-                                                 true));
+
+    // Note: we don't have operator<< for the result class, so we cannot use
+    // EXPECT_EQ.  Same for other similar cases.
+    EXPECT_TRUE(negativeResult_ == container_->search(Name("example.org"),
+                                                      false, false));
+    EXPECT_TRUE(negativeResult_ == container_->search(Name("example.org"),
+                                                      false, true));
+    EXPECT_TRUE(negativeResult_ == container_->search(Name("example.org"), true,
+                                                      false));
+    EXPECT_TRUE(negativeResult_ == container_->search(Name("example.org"), true,
+                                                      true));
 }
 
 // Put a single data source inside the container and check it can find an
@@ -267,21 +270,21 @@ TEST_F(ContainerTest, emptySearch) {
 TEST_F(ContainerTest, singleDSExactMatch) {
     container_->dataSources().push_back(ds_info_[0]);
     // This zone is not there
-    EXPECT_EQ(negativeResult_, container_->search(Name("org."), true));
+    EXPECT_TRUE(negativeResult_ == container_->search(Name("org."), true));
     // But this one is, so check it.
     positiveResult(container_->search(Name("example.org"), true),
                    ds_[0], Name("example.org"), true, "Exact match");
     // When asking for a sub zone of a zone there, we get nothing
     // (we want exact match, this would be partial one)
-    EXPECT_EQ(negativeResult_, container_->search(Name("sub.example.org."),
-                                                  true));
+    EXPECT_TRUE(negativeResult_ == container_->search(Name("sub.example.org."),
+                                                      true));
 }
 
 // When asking for a partial match, we get all that the exact one, but more.
 TEST_F(ContainerTest, singleDSBestMatch) {
     container_->dataSources().push_back(ds_info_[0]);
     // This zone is not there
-    EXPECT_EQ(negativeResult_, container_->search(Name("org.")));
+    EXPECT_TRUE(negativeResult_ == container_->search(Name("org.")));
     // But this one is, so check it.
     positiveResult(container_->search(Name("example.org")),
                    ds_[0], Name("example.org"), true, "Exact match");
@@ -304,7 +307,7 @@ TEST_F(ContainerTest, multiExactMatch) {
         SCOPED_TRACE(test_names[i]);
         multiConfiguration(i);
         // Something that is nowhere there
-        EXPECT_EQ(negativeResult_, container_->search(Name("org."), true));
+        EXPECT_TRUE(negativeResult_ == container_->search(Name("org."), true));
         // This one is there exactly.
         positiveResult(container_->search(Name("example.org"), true),
                        ds_[0], Name("example.org"), true, "Exact match");
@@ -313,8 +316,8 @@ TEST_F(ContainerTest, multiExactMatch) {
                        ds_[1], Name("sub.example.org"), true,
                        "Subdomain match");
         // But this one is in neither data source.
-        EXPECT_EQ(negativeResult_, container_->search(Name("sub.example.com."),
-                                                      true));
+        EXPECT_TRUE(negativeResult_ ==
+                    container_->search(Name("sub.example.com."), true));
     }
 }
 
@@ -324,7 +327,7 @@ TEST_F(ContainerTest, multiBestMatch) {
         SCOPED_TRACE(test_names[i]);
         multiConfiguration(i);
         // Something that is nowhere there
-        EXPECT_EQ(negativeResult_, container_->search(Name("org.")));
+        EXPECT_TRUE(negativeResult_ == container_->search(Name("org.")));
         // This one is there exactly.
         positiveResult(container_->search(Name("example.org")),
                        ds_[0], Name("example.org"), true, "Exact match");