BIND 10 trac2094, updated. 3df27b54faaac4ba46116b4820aa5ceb3563fb31 [2094] use xxx_EQ() instead of FAIL().

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Jul 20 16:49:11 UTC 2012


The branch, trac2094 has been updated
       via  3df27b54faaac4ba46116b4820aa5ceb3563fb31 (commit)
       via  af5673b049f1d31ccacda2652e824588d0da7262 (commit)
       via  1d950e29cae11777bc459fcb930acd0a10d0be11 (commit)
       via  2cc12f1554c816f6da1a5802e17a5bf6fd13c1f5 (commit)
      from  a47e80cd13b156f8e3f04e044bc11e8789392136 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3df27b54faaac4ba46116b4820aa5ceb3563fb31
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Fri Jul 20 09:48:28 2012 -0700

    [2094] use xxx_EQ() instead of FAIL().
    
    this makes the code more concise.  also add comments on why we use ASSERT
    for one of the tests.

commit af5673b049f1d31ccacda2652e824588d0da7262
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Fri Jul 20 09:41:15 2012 -0700

    [2094] use \ instead of @ for doxygen commands for consistency.
    also, use \brief instead of \short.

commit 1d950e29cae11777bc459fcb930acd0a10d0be11
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Fri Jul 20 09:37:19 2012 -0700

    [2094] make sure small size_t values should fit in 8 bits by assert.

commit 2cc12f1554c816f6da1a5802e17a5bf6fd13c1f5
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Fri Jul 20 09:34:26 2012 -0700

    [2094] cleanup: removed unnecessary CPPFLAGS.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/memory/Makefile.am      |    1 -
 src/lib/datasrc/memory/rdata_encoder.cc |    2 ++
 src/lib/util/unittests/fork.h           |    4 ++--
 src/lib/util/unittests/newhook.h        |    4 ++--
 src/lib/util/unittests/testdata.h       |    4 ++--
 src/lib/util/unittests/textdata.h       |    4 ++--
 src/lib/util/unittests/wiredata.cc      |   21 ++++++++++-----------
 src/lib/util/unittests/wiredata.h       |    4 ++--
 8 files changed, 22 insertions(+), 22 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/Makefile.am b/src/lib/datasrc/memory/Makefile.am
index fbb6ac9..0b061b6 100644
--- a/src/lib/datasrc/memory/Makefile.am
+++ b/src/lib/datasrc/memory/Makefile.am
@@ -3,7 +3,6 @@ SUBDIRS = . tests
 AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
 AM_CPPFLAGS += -I$(top_srcdir)/src/lib/dns -I$(top_builddir)/src/lib/dns
 AM_CPPFLAGS += $(BOOST_INCLUDES)
-AM_CPPFLAGS += $(SQLITE_CFLAGS)
 
 AM_CXXFLAGS = $(B10_CXXFLAGS)
 
diff --git a/src/lib/datasrc/memory/rdata_encoder.cc b/src/lib/datasrc/memory/rdata_encoder.cc
index 21bf6ba..6a32ce9 100644
--- a/src/lib/datasrc/memory/rdata_encoder.cc
+++ b/src/lib/datasrc/memory/rdata_encoder.cc
@@ -310,9 +310,11 @@ encodeRdata(const rdata::Rdata& rdata, RRClass rrclass, RRType rrtype,
             const LabelSequence labels(name);
             size_t nlen;
             const uint8_t* ndata = labels.getData(&nlen);
+            assert(nlen < 256); // nlen should fit in 8 bits
             size_t olen;
             uint8_t offset_holder[Name::MAX_LABELS];
             labels.getOffsetData(&olen, offset_holder);
+            assert(olen < 256); // olen should fit in 8 bits
             data_result.push_back(nlen);
             data_result.push_back(olen);
             data_result.insert(data_result.end(), ndata, ndata + nlen);
diff --git a/src/lib/util/unittests/fork.h b/src/lib/util/unittests/fork.h
index 3331cfa..2d27a11 100644
--- a/src/lib/util/unittests/fork.h
+++ b/src/lib/util/unittests/fork.h
@@ -18,8 +18,8 @@
 #include <unistd.h>
 
 /**
- * @file fork.h
- * @short Help functions to fork the test case process.
+ * \file fork.h
+ * \brief Help functions to fork the test case process.
  * Various functions to fork a process and feed some data to pipe, check
  * its output and such lives here.
  */
diff --git a/src/lib/util/unittests/newhook.h b/src/lib/util/unittests/newhook.h
index 7eb8ade..c90751e 100644
--- a/src/lib/util/unittests/newhook.h
+++ b/src/lib/util/unittests/newhook.h
@@ -16,8 +16,8 @@
 #define __UTIL_UNITTESTS_NEWHOOK_H 1
 
 /**
- * @file newhook.h
- * @short Enable the use of special operator new that throws for testing.
+ * \file newhook.h
+ * \brief Enable the use of special operator new that throws for testing.
  *
  * This small utility allows a test case to force the global operator new
  * to throw for a given size to test a case where memory allocation fails
diff --git a/src/lib/util/unittests/testdata.h b/src/lib/util/unittests/testdata.h
index 03bd83a..a452dc6 100644
--- a/src/lib/util/unittests/testdata.h
+++ b/src/lib/util/unittests/testdata.h
@@ -16,8 +16,8 @@
 #define __UTIL_UNITTESTS_TESTDATA_H 1
 
 /**
- * @file testdata.h
- * @short Manipulating test data files.
+ * \file testdata.h
+ * \brief Manipulating test data files.
  *
  * This utility defines functions that help test case handle test data
  * stored in a file.
diff --git a/src/lib/util/unittests/textdata.h b/src/lib/util/unittests/textdata.h
index 3e9b1aa..3e5fe0f 100644
--- a/src/lib/util/unittests/textdata.h
+++ b/src/lib/util/unittests/textdata.h
@@ -22,8 +22,8 @@
 #define __UTIL_UNITTESTS_TEXTDATA_H 1
 
 /**
- * @file textdata.h
- * @short Utilities for tests with text data.
+ * \file textdata.h
+ * \brief Utilities for tests with text data.
  *
  * This utility provides convenient helper functions for unit tests using
  * textual data.
diff --git a/src/lib/util/unittests/wiredata.cc b/src/lib/util/unittests/wiredata.cc
index 7084813..f24176d 100644
--- a/src/lib/util/unittests/wiredata.cc
+++ b/src/lib/util/unittests/wiredata.cc
@@ -34,18 +34,17 @@ matchWireData(const void* expected_data, size_t expected_len,
     for (size_t i = 0; i < cmplen; ++i) {
         const int ebyte = static_cast<const uint8_t*>(expected_data)[i];
         const int abyte = static_cast<const uint8_t*>(actual_data)[i];
-        if (ebyte != abyte) {
-            FAIL() << "Wire data mismatch at " << i << "th byte\n"
-                   << "  Actual: " << abyte << "\n"
-                   << "Expected: " << ebyte << "\n";
-            return;
-        }
-    }
-    if (expected_len != actual_len) {
-        FAIL() << "Wire data mismatch in length:\n"
-               << "  Actual: " << actual_len << "\n"
-               << "Expected: " << expected_len << "\n";
+        // Once we find a mismatch, it's quite likely that there will be many
+        // mismatches after this point.  So we stop here by using ASSERT not
+        // to be too noisy.
+        ASSERT_EQ(ebyte, abyte) << "Wire data mismatch at " << i << "th byte\n"
+                                << "  Actual: " << abyte << "\n"
+                                << "Expected: " << ebyte << "\n";
     }
+    EXPECT_EQ(expected_len, actual_len)
+        << "Wire data mismatch in length:\n"
+        << "  Actual: " << actual_len << "\n"
+        << "Expected: " << expected_len << "\n";
 }
 
 } // unittests
diff --git a/src/lib/util/unittests/wiredata.h b/src/lib/util/unittests/wiredata.h
index 8daa36b..8f1385d 100644
--- a/src/lib/util/unittests/wiredata.h
+++ b/src/lib/util/unittests/wiredata.h
@@ -17,8 +17,8 @@
 
 #include <cstddef>
 
-/// @file wiredata.h
-/// @short Utilities for tests with wire data.
+/// \file wiredata.h
+/// \brief Utilities for tests with wire data.
 ///
 /// This utility provides convenient helper functions for unit tests using
 /// wire (binary) data.



More information about the bind10-changes mailing list