40 #include <unordered_map> 43 using lib::test::showSizeof;
57 using LERR_(WRONG_TYPE);
90 checkBasicProperties();
104 CHECK (dID1.isValid());
105 CHECK (dID2.isValid());
106 CHECK (dID3.isValid());
107 CHECK (dID1 != dID2); CHECK (dID2 != dID1);
108 CHECK (dID2 != dID3); CHECK (dID3 != dID2);
109 CHECK (dID1 != dID3); CHECK (dID3 != dID1);
114 CHECK (tID1.isValid());
115 CHECK (tID2.isValid());
116 CHECK (tID3.isValid());
117 CHECK (tID1 != tID2); CHECK (tID2 != tID1);
118 CHECK (tID2 != tID3); CHECK (tID3 != tID2);
119 CHECK (tID1 != tID3); CHECK (tID3 != tID1);
121 cout << dID1 << endl;
122 cout << dID2 << endl;
123 cout << dID3 << endl;
125 cout << tID1 << endl;
126 cout << tID2 << endl;
127 cout << tID3 << endl;
131 CHECK (!isSameObject (x, dID2));
136 checkBasicProperties ()
139 using steam::asset::STRUCT;
141 using steam::asset::idi::getAssetIdent;
143 ForkID tID(
" test ⚡ ☠ ☭ ⚡ track ");
146 CHECK (
"test_track" == tID.getSym());
147 CHECK (tID ==
ForkID(
"☢ test ☢ track ☢"));
148 CHECK (tID ==
ForkID(
string{
"☢ test ☢ track ☢"}));
153 CHECK (tID.getHash() ==
ForkID(
"☢ test ☢ track ☢").getHash());
155 CHECK (getAssetIdent(tID) == Asset::Ident(
"test_track", Category(STRUCT,
"forks"),
"lumi", 0));
157 CHECK (tID.getSym() == getAssetIdent(tID).
name);
158 CHECK (getAssetIdent(
ForkID()).category == Category (STRUCT,
"forks"));
159 CHECK (getAssetIdent(
ClipID()).category == Category (STRUCT,
"clips"));
162 CHECK (cID2.getSym() < cID3.getSym());
165 for (uint i=0; i<10000; ++i)
167 ForkID arbitrary(randStr(30));
168 CHECK (0 < arbitrary.getHash());
169 CHECK (tID.getHash() != arbitrary.getHash());
171 CHECK (tID.getHash() == arbitrary.getHash());
172 CHECK (tID.getSym() == arbitrary.getSym());
173 CHECK (getAssetIdent(tID)== getAssetIdent(arbitrary));
176 cout << showSizeof<ForkID>() << endl;
177 cout << showSizeof<BareEntryID>() << endl;
178 cout << showSizeof<lumiera_uid>() << endl;
179 cout << showSizeof<string>() << endl;
180 cout << showSizeof<void*>() << endl;
193 CHECK (tID1 == tID2);
196 CHECK (tID2 <= tID3);
197 CHECK (tID3 >= tID2);
201 CHECK (tID3 <= tID4);
202 CHECK (tID4 >= tID3);
205 ForkID trackID1, trackID2;
206 CHECK (trackID1 < trackID2);
225 CHECK (fID.getHash() != cID.getHash());
226 CHECK (fID.getSym() == cID.getSym());
231 CHECK (bIDf != bIDc);
232 CHECK (bIDf.getHash() != bIDc.getHash());
233 CHECK (bIDf.getSym() == bIDc.getSym());
234 CHECK (
"suspicious" == bIDc.getSym());
238 ForkID tIDnew = bIDf.recast<Fork>();
240 CHECK (tIDnew == fID);
241 CHECK (cIDnew == cID);
256 CHECK (bIDf == bIDt_copy);
257 CHECK (!isSameObject (bIDf, bIDt_copy));
260 CHECK (cID != bIDt_copy);
261 CHECK (fID == bIDt_copy);
263 CHECK (bIDf ==
ForkID (
"suspicious"));
264 CHECK (bIDf !=
ClipID (
"suspicious"));
265 CHECK (bIDc ==
ClipID (
"suspicious"));
272 typedef std::unordered_map<DummyID, string, DummyID::UseEmbeddedHash> Hashtable;
286 for (uint i=0; i<100000; ++i)
289 tab[dummy] = string(dummy);
292 CHECK (and_all (tab, verifyEntry));
293 CHECK (100000 == tab.size());
298 verifyEntry (Hashtable::value_type
entry)
300 return checkForHashCollision(
string(entry.first), entry.second);
304 checkForHashCollision(
string const& key,
string const& val)
306 if (key != val) cout <<
"Hash collision: "<<key<<
" != "<<val<< endl;
type erased baseclass for building a combined hash and symbolic ID.
string name
element ID, comprehensible but sanitised.
Tree like classification of Assets.
AnyPair entry(Query< TY > const &query, typename WrapReturn< TY >::Wrapper &obj)
helper to simplify creating mock table entries, wrapped correctly
inline string literal This is a marker type to indicate that
MObject in the Session to represent a clip on the timeline.
typed symbolic and hash ID for asset-like position accounting.
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
bool and_all(CON const &elements, FUN function, P1 &&bind1, ARGS &&...args)
Accept binding for arbitrary function arguments.
A user visible/editable Clip is a reference to a contiguous sequence of media data loaded as Asset in...
Organisational grouping device within the Session model ("Track" / "Media Bin").
Implementation namespace for support and library code.
string randStr(size_t len)
create garbage string of given length
Token or Atom with distinct identity.
EntryID< TAR > const & recast() const
try to upcast this BareEntryID to a fully typed EntryID.
Marker types to indicate a literal string and a Symbol.
Simple test class runner.
Superinterface describing especially bookkeeping properties.
A collection of frequently used helper functions to support unit testing.
Rarely used specialisations of otherwise heavily used generic code.
A Fork serves as grouping device within the Session.
Bare symbolic and hash ID used for accounting of asset like entries.
unsigned char lumiera_uid[16]
storage for a Lumiera unique ID, based on a 128bit random number
Perform operations "for each element" of a collection.
Naming and labelling scheme for structural assets.
bool contains(SEQ const &cont, typename SEQ::const_reference val)
shortcut for brute-force containment test in any sequential container
bool isSameObject(A const &a, B const &b)
compare plain object identity, bypassing any custom comparison operators.