Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
EntryID_test Class Reference

Description

Test:
proof-of-concept test for a combined symbolic and hash based ID.
  • create some symbolic IDs
  • check default assignment works properly
  • check comparisons
  • check hashing
  • use the embedded hash ID (LUID) as hashtable key
See also
lib::HashIndexed::Id
mobject::Placement real world usage example

Definition at line 83 of file entry-id-test.cpp.

Private Types

typedef std::unordered_map
< DummyID, string,
DummyID::UseEmbeddedHash
Hashtable
 

Private Member Functions

void buildHashtable ()
 
void checkBasicProperties ()
 
void checkComparisions ()
 
void checkCreation ()
 
void checkErasure ()
 
virtual void run (Arg)
 

Static Private Member Functions

static bool checkForHashCollision (string const &key, string const &val)
 
static bool verifyEntry (Hashtable::value_type entry)
 

Member Typedef Documentation

typedef std::unordered_map<DummyID, string, DummyID::UseEmbeddedHash> Hashtable
private

Definition at line 269 of file entry-id-test.cpp.

Member Function Documentation

virtual void run ( Arg  )
inlineprivatevirtual

Definition at line 87 of file entry-id-test.cpp.

References EntryID_test::buildHashtable(), EntryID_test::checkBasicProperties(), EntryID_test::checkComparisions(), EntryID_test::checkCreation(), and EntryID_test::checkErasure().

+ Here is the call graph for this function:

void checkCreation ( )
inlineprivate

Definition at line 99 of file entry-id-test.cpp.

References util::isSameObject(), and BareEntryID::isValid().

Referenced by EntryID_test::run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void checkBasicProperties ( )
inlineprivate

Definition at line 136 of file entry-id-test.cpp.

References proc::asset::idi::getAssetIdent(), BareEntryID::getHash(), BareEntryID::getSym(), Asset::Ident::name, lib::test::randStr(), and proc::asset::STRUCT.

Referenced by EntryID_test::run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void checkComparisions ( )
inlineprivate

Definition at line 184 of file entry-id-test.cpp.

Referenced by EntryID_test::run().

+ Here is the caller graph for this function:

void checkErasure ( )
inlineprivate
Test:
handling of EntryIDs through their common base class, which means erasing the specific type information. While this type information can't be recovered after erasure, we can try to upcast back to a known type; this upcast is safe, because the embedded hash-ID is based on the type info.

Definition at line 217 of file entry-id-test.cpp.

References BareEntryID::getHash(), BareEntryID::getSym(), util::isSameObject(), BareEntryID::recast(), EntryID< TY >::recast(), and VERIFY_ERROR.

Referenced by EntryID_test::run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void buildHashtable ( )
inlineprivate
Test:
build a hashtable, using EntryID as key, thereby using the embedded hash-ID
Note
there is a known weakness of the boost::hash when used on IDs with a running number suffix. /////TICKET #587 We use a trick to spread the numbers better.
See also
HashGenerator_test::verify_Knuth_workaround

Definition at line 279 of file entry-id-test.cpp.

References util::and_all(), and EntryID_test::verifyEntry().

Referenced by EntryID_test::run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool verifyEntry ( Hashtable::value_type  entry)
inlinestaticprivate

Definition at line 295 of file entry-id-test.cpp.

References EntryID_test::checkForHashCollision().

Referenced by EntryID_test::buildHashtable().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool checkForHashCollision ( string const &  key,
string const &  val 
)
inlinestaticprivate

Definition at line 301 of file entry-id-test.cpp.

Referenced by EntryID_test::verifyEntry().

+ Here is the caller graph for this function:

+ Inheritance diagram for EntryID_test:
+ Collaboration diagram for EntryID_test:

The documentation for this class was generated from the following file: