[svn] commit: r3691 - /branches/trac408/src/lib/nsas/tests/nameserver_entry_unittest.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Dec 1 12:59:57 UTC 2010


Author: vorner
Date: Wed Dec  1 12:59:57 2010
New Revision: 3691

Log:
Test expected behaviour/allowed behaviour

The test was too strict and bound to previous implementation. It is not
strictly required, and is implemented differently now.

Modified:
    branches/trac408/src/lib/nsas/tests/nameserver_entry_unittest.cc

Modified: branches/trac408/src/lib/nsas/tests/nameserver_entry_unittest.cc
==============================================================================
--- branches/trac408/src/lib/nsas/tests/nameserver_entry_unittest.cc (original)
+++ branches/trac408/src/lib/nsas/tests/nameserver_entry_unittest.cc Wed Dec  1 12:59:57 2010
@@ -109,24 +109,13 @@
     NameserverEntry::AddressVector vec;
     alpha->getAddresses(vec);
 
-    // Copy into a vector of time_t.
-    vector<uint32_t> rtt;
-    for (NameserverEntry::AddressVectorIterator i = vec.begin();
-        i != vec.end(); ++i) {
-        rtt.push_back(i->getRTT());
-    }
-
-    // Ensure that the addresses are sorted and note how many RTTs we have.
-    sort(rtt.begin(), rtt.end());
-    int oldcount = rtt.size();
-
-    // Remove duplicates and notw the new size.
-    vector<uint32_t>::iterator newend = unique(rtt.begin(), rtt.end());
-    rtt.erase(newend, rtt.end());
-    int newcount = rtt.size();
-
-    // .. and we don't expect to have lost anything.
-    EXPECT_EQ(oldcount, newcount);
+    // Check they are not 0 and they are all small, they should be some kind
+    // of randomish numbers, so we can't expect much more here
+    BOOST_FOREACH(const AddressEntry& entry, vec) {
+        EXPECT_GT(entry.getRTT(), 0);
+        // 20 is some arbitrary small value
+        EXPECT_LT(entry.getRTT(), 20);
+    }
 }
 
 // Set an address RTT to a given value




More information about the bind10-changes mailing list