81 CHECK (not log.
verify(
"γ"));
146 log1.
event(
"baked beans");
163 CHECK (log1 != log2);
164 CHECK (copy == log2);
168 CHECK (log1 == log2);
169 CHECK (copy != log2);
171 CHECK (log1.
verify(
"logJoin|{ham}").
after(
"baked beans"));
174 log2.
event(
"sausage");
179 CHECK (copy.
verify(
"joined|{spam}").
after(
"EventLogHeader"));
181 copy.
event(
"spam tomato");
184 CHECK (copy.
verify(
"joined|{spam}").
before(
"spam tomato"));
187 CHECK (join(log1) ==
string(
188 "Rec(EventLogHeader| this = spam ), "
189 "Rec(event|{baked beans}), "
190 "Rec(EventLogHeader| this = ham ), "
191 "Rec(event|{eggs}), "
192 "Rec(event|{bacon}), "
193 "Rec(logJoin|{ham}), "
194 "Rec(event|{sausage})"));
196 CHECK (join(copy) ==
string(
197 "Rec(EventLogHeader| this = ham ), "
198 "Rec(joined|{spam}), "
199 "Rec(event|{spam tomato})"));
207 log.
call (
this,
"fun1");
208 log.
call (
"some",
"fun2");
209 log.
call (
"more",
"fun3",
"facts", 3.2,1);
213 CHECK (join(log) ==
string(
214 "Rec(EventLogHeader| this = funCall ), "
216 "Rec(call| fun = fun2, this = some ), "
217 "Rec(call| fun = fun3, this = more |{facts, 3.2, 1})"));
228 CHECK (log.
verifyCall(
"fun3").
arg(
string(
"facts"), 3.2f, int64_t(1)));
250 CHECK (log.
verify(
"fun").
on(
"some"));
251 CHECK (log.
verify(
"fun").
on(
"more"));
252 CHECK (log.
verify(
"fun").
on(
"more").
on(
"more"));
266 log.
event(
"no",
"fun");
267 log.
call(
"some",
"fun");
279 CHECK (join(log) ==
string(
280 "Rec(EventLogHeader| this = event trace ), "
281 "Rec(event| ID = no |{fun}), "
282 "Rec(call| fun = fun, this = some )"));
290 log.
note (
"type=some",
"ID=weird",
"stuff");
292 log.
error (
"horrible");
293 log.
fatal (
"destiny");
297 CHECK (log.
verify(
"theHog")
304 CHECK (log.
verify(
"this").
type(
"EventLogHeader")
324 CHECK (join(log) ==
string(
325 "Rec(EventLogHeader| this = theHog ), "
326 "Rec(some| ID = weird |{stuff}), "
327 "Rec(warn|{danger}), "
328 "Rec(error|{horrible}), "
329 "Rec(fatal|{destiny}), "
330 "Rec(create|{something}), "
331 "Rec(destroy|{everything})"));
339 log.
note (
"type=spam",
"egg and bacon"
340 ,
"egg sausage and bacon"
342 ,
"egg bacon and spam"
343 ,
"egg bacon sausage and spam"
344 ,
"spam bacon sausage and spam"
345 ,
"spam egg spam spam bacon and spam"
346 ,
"spam sausage spam spam bacon spam tomato and spam");
347 log.
fatal(
"Lobster Thermidor a Crevette with a mornay sauce served in a Provencale manner "
348 "with shallots and aubergines garnished with truffle pate, brandy and with a fried egg on top and spam");
377 CHECK (log.
verify(
"obnoxious").
type(
"EventLogHeader").
on(
"obnoxious"));
380 log.
clear(
"unbearable");
383 CHECK (log.
verify(
"unbearable").
type(
"EventLogHeader").
on(
"unbearable"));
Helper to log and verify the occurrence of events.
EventLog & warn(string text)
Log a warning entry.
EventLog & destroy(string text)
Log the destruction of an object.
EventLog & event(string text)
log some text as event
EventMatch verify(string match) const
start a query to match for some substring.
EventLog & error(string text)
Log an error note.
EventLog & clear()
purge log contents while retaining just the original Header-ID
EventMatch verifyCall(string match) const
start a query to match especially a function call
EventMatch verifyEvent(string match) const
start a query to match for some event.
EventLog & joinInto(EventLog &otherLog)
Merge this log into another log, forming a combined log.
EventMatch verifyMatch(string regExp) const
start a query to match with a regular expression
EventLog & create(string text)
Log the creation of an object.
EventMatch ensureNot(string match) const
start a query to ensure the given expression does not match.
EventLog & note(ELMS const &...initialiser)
EventLog & call(string target, string function)
Log occurrence of a function call with no arguments.
EventLog & fatal(string text)
Log a fatal failure.
EventMatch & type(string typeID)
refine filter to additionally require a matching log entry type
EventMatch & beforeMatch(string regExp)
find a match with the given regular expression
EventMatch & id(string classifier)
refine filter to additionally match on the ID attribute
EventMatch & arg(ARGS const &...args)
refine filter to additionally require specific arguments
EventMatch & argMatch(ARGS const &...regExps)
refine filter to additionally cover all arguments with a series of regular expressions.
EventMatch & before(string match)
find a match (substring match) of the given text in an EventLog entry after the current position
EventMatch & beforeEvent(string match)
find a match for an "event" after the current point of reference
EventMatch & locate(string match)
basic search function: continue linear lookup over the elements of the EventLog to find a match (subs...
EventMatch & argPos(size_t idx, ARG const &arg)
refine filter to additionally require match on a specific positional argument
EventMatch & after(string match)
find a match (substring match) of the given text in an EventLog entry before the current position,...
EventMatch & attrib(string key, string valueMatch)
refine filter to additionally match on a specific attribute
EventMatch & on(string targetID)
refine filter to additionally match the ‘'this’` attribute
EventMatch & beforeCall(string match)
find a match for some function invocation after the current point of reference
EventMatch & afterMatch(string regExp)
void verify_simpleUsage()
void verify_negatedMatch()
void verify_backwardMatch()
void verify_callLogging()
void verify_regExpMatch()
void verify_eventLogging()
void verify_genericLogging()
Support for verifying the occurrence of events from unit tests.
string instanceTypeID(const TY *const obj)
designation of an distinct object instance
Implementation namespace for support and library code.
Test runner and basic definitions for tests.
string join(COLL &&coll, string const &delim=", ")
enumerate a collection's contents, separated by delimiter.
bool isnil(lib::time::Duration const &dur)
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...