A checksum accumulator. More...
#include <Checksum.h>
Public Member Functions | |
Checksum () | |
Constructs a zeroed checksum. More... | |
uint64_t | Value () const |
Retrieves the value of the checksum, as a uint64_t. More... | |
void | Add (uint64_t x) |
Add a uint64_t to the checksum. More... | |
void | Add (const string &str) |
Add a string to the checksum. More... | |
bool | operator== (const Checksum &other) const |
Compares one Checksum to another for equality. More... | |
bool | operator!= (const Checksum &other) const |
Compares one Checksum to another for inequality. More... | |
Static Public Member Functions | |
static void | RunUnitTests (int &nSucceeded, int &nFailures) |
![]() | |
static void | RunUnitTests (int &nSucceeded, int &nFailures) |
Runs unit test cases. More... | |
A checksum accumulator.
The main purpose of this class is as a helper in unit tests, where objects such as trees are hard to compare to each other. A checksum of the first tree can then be compared with a checksum of the second tree.
Note: This is not scientifically correct in any way. It is just something I made up, for unit testing purposes. (2007-12-27)
Definition at line 47 of file Checksum.h.
Checksum::Checksum | ( | ) |
Constructs a zeroed checksum.
Definition at line 31 of file Checksum.cc.
void Checksum::Add | ( | const string & | str | ) |
Add a string to the checksum.
str | The string to add. |
Definition at line 50 of file Checksum.cc.
References Add().
void Checksum::Add | ( | uint64_t | x | ) |
Add a uint64_t to the checksum.
x | Value to add. |
Definition at line 43 of file Checksum.cc.
Referenced by Add(), and Component::AddChecksum().
bool Checksum::operator!= | ( | const Checksum & | other | ) | const |
Compares one Checksum to another for inequality.
other | The Checksum to compare to. |
Definition at line 66 of file Checksum.cc.
bool Checksum::operator== | ( | const Checksum & | other | ) | const |
Compares one Checksum to another for equality.
other | The Checksum to compare to. |
Definition at line 60 of file Checksum.cc.
|
static |
uint64_t Checksum::Value | ( | ) | const |
Retrieves the value of the checksum, as a uint64_t.
Definition at line 37 of file Checksum.cc.