31#include <unordered_map>
48 using LERR_(WRONG_TYPE);
95 CHECK (dID1.isValid());
96 CHECK (dID2.isValid());
97 CHECK (dID3.isValid());
98 CHECK (dID1 != dID2); CHECK (dID2 != dID1);
99 CHECK (dID2 != dID3); CHECK (dID3 != dID2);
100 CHECK (dID1 != dID3); CHECK (dID3 != dID1);
105 CHECK (tID1.isValid());
106 CHECK (tID2.isValid());
107 CHECK (tID3.isValid());
108 CHECK (tID1 != tID2); CHECK (tID2 != tID1);
109 CHECK (tID2 != tID3); CHECK (tID3 != tID2);
110 CHECK (tID1 != tID3); CHECK (tID3 != tID1);
112 cout << dID1 << endl;
113 cout << dID2 << endl;
114 cout << dID3 << endl;
116 cout << tID1 << endl;
117 cout << tID2 << endl;
118 cout << tID3 << endl;
122 CHECK (!isSameObject (x, dID2));
134 ForkID tID(
" test ⚡ ☠ ☭ ⚡ track ");
137 CHECK (
"test_track" == tID.getSym());
138 CHECK (tID ==
ForkID(
"☢ test ☢ track ☢"));
139 CHECK (tID ==
ForkID(
string{
"☢ test ☢ track ☢"}));
144 CHECK (tID.getHash() ==
ForkID(
"☢ test ☢ track ☢").getHash());
146 CHECK (getAssetIdent(tID) == Asset::Ident(
"test_track", Category(STRUCT,
"forks"),
"lumi", 0));
148 CHECK (tID.getSym() == getAssetIdent(tID).name);
149 CHECK (getAssetIdent(
ForkID()).category == Category (STRUCT,
"forks"));
150 CHECK (getAssetIdent(
ClipID()).category == Category (STRUCT,
"clips"));
153 CHECK (cID2.getSym() < cID3.getSym());
156 for (
uint i=0; i<10000; ++i)
158 ForkID arbitrary(randStr(30));
159 CHECK (0 < arbitrary.getHash());
160 CHECK (tID.getHash() != arbitrary.getHash());
162 CHECK (tID.getHash() == arbitrary.getHash());
163 CHECK (tID.getSym() == arbitrary.getSym());
164 CHECK (getAssetIdent(tID)== getAssetIdent(arbitrary));
167 cout << showSizeof<ForkID>() << endl;
168 cout << showSizeof<BareEntryID>() << endl;
169 cout << showSizeof<lumiera_uid>() << endl;
170 cout << showSizeof<string>() << endl;
171 cout << showSizeof<void*>() << endl;
184 CHECK (tID1 == tID2);
187 CHECK (tID2 <= tID3);
188 CHECK (tID3 >= tID2);
192 CHECK (tID3 <= tID4);
193 CHECK (tID4 >= tID3);
196 ForkID trackID1, trackID2;
197 CHECK (trackID1 < trackID2);
216 CHECK (fID.getHash() != cID.getHash());
217 CHECK (fID.getSym() == cID.getSym());
222 CHECK (bIDf != bIDc);
225 CHECK (
"suspicious" == bIDc.
getSym());
231 CHECK (tIDnew == fID);
232 CHECK (cIDnew == cID);
239 CHECK (fID == ForkID::recast (bIDf));
247 CHECK (bIDf == bIDt_copy);
248 CHECK (!isSameObject (bIDf, bIDt_copy));
251 CHECK (cID != bIDt_copy);
252 CHECK (fID == bIDt_copy);
254 CHECK (bIDf ==
ForkID (
"suspicious"));
255 CHECK (bIDf !=
ClipID (
"suspicious"));
256 CHECK (bIDc ==
ClipID (
"suspicious"));
263 typedef std::unordered_map<DummyID, string, DummyID::UseEmbeddedHash>
Hashtable;
277 for (
uint i=0; i<100000; ++i)
280 tab[dummy] = string(dummy);
284 CHECK (100000 == tab.size());
297 if (key != val) cout <<
"Hash collision: "<<key<<
" != "<<val<< endl;
Token or Atom with distinct identity.
type erased baseclass for building a combined hash and symbolic ID.
LuidH const & getHash() const
EntryID< TAR > const & recast() const
string const & getSym() const
static bool checkForHashCollision(string const &key, string const &val)
std::unordered_map< DummyID, string, DummyID::UseEmbeddedHash > Hashtable
static bool verifyEntry(Hashtable::value_type entry)
void checkBasicProperties()
Superinterface describing especially bookkeeping properties.
Tree like classification of Assets.
A user visible/editable Clip is a reference to a contiguous sequence of media data loaded as Asset in...
A Fork serves as grouping device within the Session.
Bare symbolic and hash ID used for accounting of asset like entries.
Organisational grouping device within the Session model ("Track" / "Media Bin").
unsigned char lumiera_uid[16]
storage for a Lumiera unique ID, based on a 128bit random number
MObject in the Session to represent a clip on the timeline.
EntryID< steam::mobject::session::Fork > ForkID
EntryID< steam::mobject::session::Clip > ClipID
string showSizeof(size_t siz, string name)
for printing sizeof().
string randStr(size_t len)
create garbage string of given length
Implementation namespace for support and library code.
Asset::Ident getAssetIdent(lib::idi::EntryID< TY > const &entryID, asset::Kind assetKind=STRUCT)
generate an Asset identification tuple based on this EntryID's symbolic ID and type information.
Test runner and basic definitions for tests.
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee's memory identities.
bool contains(MAP &map, typename MAP::key_type const &key)
shortcut for containment test on a map
bool and_all(IT i, IT end, FUN predicate)
All quantification: check if all elements of a collection satisfy the given predicate.
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Naming and labelling scheme for structural assets.
typed symbolic and hash ID for asset-like position accounting.
Marker types to indicate a literal string and a Symbol.
A collection of frequently used helper functions to support unit testing.
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
Rarely used specialisations of otherwise heavily used generic code.
Perform operations "for each element" of a collection.