|
OTest2
A C++ testing framework
|
A simple generator of a testmark hash. More...
#include <testmarkhash.h>
Public Member Functions | |
| TestMarkHash () | |
| Ctor. More... | |
| TestMarkHash (TestMarkHash &&other_) noexcept | |
| Move ctor. More... | |
| ~TestMarkHash () | |
| Dtor. More... | |
| TestMarkHash (const TestMarkHash &)=delete | |
| TestMarkHash & | operator= (const TestMarkHash &)=delete |
| void | addData (const std::uint8_t *data_, std::size_t size_) |
| Append piece of data. More... | |
| void | addTerminator () |
| Append a terminataor character into the hash. More... | |
| void | addHashCode (TestMarkHashCode code_) |
| Append a hash code of another testmark. More... | |
| void | addString (const char *string_) |
| Append a string literal. More... | |
| TestMarkHashCode | getHashCode () const noexcept |
| Get currently computed hash code. More... | |
| void | addBasicType (const char *type_name_, const std::uint8_t *data_, std::size_t size_) |
| Add hash for a value of a basic type. More... | |
| void | addBasicType (const char *type_name_, const std::string &value_) |
| Add hash for a string value of a basic type. More... | |
Static Public Member Functions | |
| template<typename Type_ > | |
| static TestMarkHashCode | hashBasicType (const char *type_name_, Type_ value_) |
| static TestMarkHashCode | hashBasicType (const char *type_name_, const std::string &value_) |
A simple generator of a testmark hash.
This class computes a hash value for a test mark tree. It's an attempt to get a simple value to compare the whole subtree.
The used FNV-1 function may be a wrong choice. However, I don't need a strong hash function - a collision will cause no problem, just printing of a false test-mark difference.
Definition at line 40 of file testmarkhash.h.
| OTest2::TestMarkHash::TestMarkHash | ( | ) |
Ctor.
Definition at line 26 of file testmarkhash.cpp.
|
noexcept |
Move ctor.
Definition at line 31 of file testmarkhash.cpp.
| OTest2::TestMarkHash::~TestMarkHash | ( | ) |
Dtor.
Definition at line 37 of file testmarkhash.cpp.
|
delete |
| void OTest2::TestMarkHash::addBasicType | ( | const char * | type_name_, |
| const std::string & | value_ | ||
| ) |
Add hash for a string value of a basic type.
| type_name_ | Name of the type |
| value_ | The value |
Definition at line 81 of file testmarkhash.cpp.
| void OTest2::TestMarkHash::addBasicType | ( | const char * | type_name_, |
| const std::uint8_t * | data_, | ||
| std::size_t | size_ | ||
| ) |
Add hash for a value of a basic type.
| type_name_ | Name of the type |
| data_ | Binary form of data |
| size_ | Size of data |
Definition at line 72 of file testmarkhash.cpp.
| void OTest2::TestMarkHash::addData | ( | const std::uint8_t * | data_, |
| std::size_t | size_ | ||
| ) |
Append piece of data.
| data_ | Data |
| size_ | Length of data |
Definition at line 41 of file testmarkhash.cpp.
| void OTest2::TestMarkHash::addHashCode | ( | TestMarkHashCode | code_ | ) |
Append a hash code of another testmark.
Definition at line 56 of file testmarkhash.cpp.
| void OTest2::TestMarkHash::addString | ( | const char * | string_ | ) |
Append a string literal.
Definition at line 61 of file testmarkhash.cpp.
| void OTest2::TestMarkHash::addTerminator | ( | ) |
Append a terminataor character into the hash.
Definition at line 51 of file testmarkhash.cpp.
|
noexcept |
Get currently computed hash code.
Definition at line 68 of file testmarkhash.cpp.
|
static |
Definition at line 91 of file testmarkhash.cpp.
|
inlinestatic |
Definition at line 122 of file testmarkhash.h.
|
delete |
1.8.17