31 #include <unordered_map> 34 using lib::test::showSizeof;
48 using LERR_(WRONG_TYPE);
81 checkBasicProperties();
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));
127 checkBasicProperties ()
130 using steam::asset::STRUCT;
132 using steam::asset::idi::getAssetIdent;
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);
223 CHECK (bIDf.getHash() != bIDc.getHash());
224 CHECK (bIDf.getSym() == bIDc.getSym());
225 CHECK (
"suspicious" == bIDc.getSym());
229 ForkID tIDnew = bIDf.recast<Fork>();
231 CHECK (tIDnew == fID);
232 CHECK (cIDnew == cID);
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);
283 CHECK (and_all (tab, verifyEntry));
284 CHECK (100000 == tab.size());
289 verifyEntry (Hashtable::value_type
entry)
291 return checkForHashCollision(
string(entry.first), entry.second);
295 checkForHashCollision(
string const& key,
string const& val)
297 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.
Simplistic 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, based directly on the referee's memory identities. ...