38   void Check ( 
const std::string hashName, 
const uint32_t hash);
 
   39   void Check ( 
const std::string hashName, 
const uint64_t hash);
 
   44   void Check ( 
const std::string hashName, 
const int bits, 
const uint64_t hash);
 
   45   virtual void DoRun (
void);
 
   50     key (
"The quick brown fox jumped over the lazy dogs.")
 
   61   Check (hashName, 32, hash);
 
   67   Check (hashName, 64, hash);
 
   90   std::cout << 
GetName () << 
"checking " 
   92             << bits     << 
"-bit result...";
 
   94                          hashName << 
" " << type
 
   95                          << 
" produced "  << std::hex << std::setw (w) << hash
 
   96                          << 
", expected " << std::hex << std::setw (w) << hashRef
 
   99   std::cout << std::hex << std::setw (w) << hash << 
", ok" 
  100             << std::dec << std::endl;
 
  119   virtual void DoRun (
void);
 
  134   std::cout << 
GetName () << 
"checking with key: \"" 
  135             << 
key << 
"\"" << std::endl;
 
  154   virtual void DoRun (
void);
 
  169   Hasher hasher = 
Hasher ( Create<Hash::Function::Fnv1a> () );
 
  188   virtual void DoRun (
void);
 
  203   Hasher hasher = 
Hasher ( Create<Hash::Function::Murmur3> () );
 
  221 gnu_sum (
const char * buffer, 
const size_t size)
 
  223   const char * p = buffer;
 
  224   const char * 
const pend = p + size;
 
  226   uint16_t checksum = 0;     
 
  230       checksum = (checksum >> 1) + ((checksum & 1) << 15);  
 
  240   uint32_t h = 
gnu_sum (buffer, size);
 
  241   return (uint32_t)( (h << 16) + h);
 
  249   return (uint64_t)( (h << 32) + h);
 
  261   virtual void DoRun (
void);
 
  290   virtual void DoRun (
void);
 
  319   virtual void DoRun (
void);
 
  351   key1 = 
"The quick brown ";
 
  352   key2 = 
"Incremental.";
 
  355   std::cout << 
GetName () << 
"checking with key: " 
  356             << 
"\"" << 
key1  << 
"\"[" << 
key1.size ()  << 
"] + " 
  357             << 
"\"" << key2  << 
"\"[" << key2.size ()  << 
"]" << std::endl;
 
  358   std::cout << 
GetName () << 
"equivalent to:     " 
  359             << 
"\"" << 
key12 << 
"\"[" << 
key12.size () << 
"]" << std::endl;
 
  362   DoHash ( 
"murmur3", 
Hasher ( Create<Hash::Function::Murmur3> () ) );
 
  363   DoHash ( 
"FNV1a",   
Hasher ( Create<Hash::Function::Fnv1a> () ) );
 
Hash functions test suite. 
HashTestCase(const std::string name)
virtual ~DefaultHashTestCase()
Test 32-bit function pointer. 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
void DoHash(const std::string name, Hasher hasher)
uint64_t gnu_sum64(const char *buffer, const size_t size)
static HashTestSuite g_hashTestSuite
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not. 
Test 64-bit function pointer. 
virtual ~Murmur3TestCase()
virtual ~Hash64FunctionPtrTestCase()
virtual ~IncrementalTestCase()
void Check(const std::string hashName, const uint32_t hash)
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite. 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
uint32_t gnu_sum32(const char *buffer, const size_t size)
uint32_t GetHash32(const char *buffer, const size_t size)
Compute 32-bit hash of a byte buffer. 
uint32_t Hash32(const char *buffer, const size_t size)
Compute 32-bit hash of a byte buffer, using the default hash function. 
Hasher & clear(void)
Restore initial state. 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
Test incremental hashing. 
Hash32FunctionPtrTestCase()
uint64_t Hash64(const char *buffer, const size_t size)
Compute 64-bit hash of a byte buffer, using the default hash function. 
std::string GetName(void) const 
virtual ~Hash32FunctionPtrTestCase()
uint64_t GetHash64(const char *buffer, const size_t size)
Compute 64-bit hash of a byte buffer. 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
Hash64FunctionPtrTestCase()
Base class for hash tests. 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
Generic Hash function interface. 
uint16_t gnu_sum(const char *buffer, const size_t size)