67 verify_backwardMatch();
68 verify_negatedMatch();
71 verify_eventLogging();
72 verify_genericLogging();
90 CHECK (not log.
verify(
"γ"));
102 verify_backwardMatch ()
124 verify_negatedMatch ()
155 log1.
event(
"baked beans");
168 CHECK (copy.verify(
"ham").before(
"eggs").before(
"bacon"));
172 CHECK (log1 != log2);
173 CHECK (copy == log2);
177 CHECK (log1 == log2);
178 CHECK (copy != log2);
180 CHECK (log1.
verify(
"logJoin|{ham}").
after(
"baked beans"));
183 log2.
event(
"sausage");
186 CHECK (copy.ensureNot(
"logJoin"));
187 CHECK (copy.ensureNot(
"sausage"));
188 CHECK (copy.verify(
"joined|{spam}").after(
"EventLogHeader"));
190 copy.
event(
"spam tomato");
193 CHECK (copy.verify(
"joined|{spam}").before(
"spam tomato"));
196 CHECK (join(log1) ==
string(
197 "Rec(EventLogHeader| this = spam ), " 198 "Rec(event|{baked beans}), " 199 "Rec(EventLogHeader| this = ham ), " 200 "Rec(event|{eggs}), " 201 "Rec(event|{bacon}), " 202 "Rec(logJoin|{ham}), " 203 "Rec(event|{sausage})"));
205 CHECK (join(copy) ==
string(
206 "Rec(EventLogHeader| this = ham ), " 207 "Rec(joined|{spam}), " 208 "Rec(event|{spam tomato})"));
213 verify_callLogging ()
216 log.
call (
this,
"fun1");
217 log.
call (
"some",
"fun2");
218 log.
call (
"more",
"fun3",
"facts", 3.2,1);
222 CHECK (join(log) ==
string(
223 "Rec(EventLogHeader| this = funCall ), " 225 "Rec(call| fun = fun2, this = some ), " 226 "Rec(call| fun = fun3, this = more |{facts, 3.2, 1})"));
237 CHECK (log.
verifyCall(
"fun3").
arg(
string(
"facts"), 3.2f, int64_t(1)));
259 CHECK (log.
verify(
"fun").
on(
"some"));
260 CHECK (log.
verify(
"fun").
on(
"more"));
261 CHECK (log.
verify(
"fun").
on(
"more").
on(
"more"));
272 verify_eventLogging ()
275 log.
event(
"no",
"fun");
276 log.
call(
"some",
"fun");
288 CHECK (join(log) ==
string(
289 "Rec(EventLogHeader| this = event trace ), " 290 "Rec(event| ID = no |{fun}), " 291 "Rec(call| fun = fun, this = some )"));
296 verify_genericLogging ()
299 log.note (
"type=some",
"ID=weird",
"stuff");
301 log.
error (
"horrible");
302 log.
fatal (
"destiny");
306 CHECK (log.
verify(
"theHog")
313 CHECK (log.
verify(
"this").
type(
"EventLogHeader")
333 CHECK (join(log) ==
string(
334 "Rec(EventLogHeader| this = theHog ), " 335 "Rec(some| ID = weird |{stuff}), " 336 "Rec(warn|{danger}), " 337 "Rec(error|{horrible}), " 338 "Rec(fatal|{destiny}), " 339 "Rec(create|{something}), " 340 "Rec(destroy|{everything})"));
345 verify_regExpMatch ()
348 log.note (
"type=spam",
"egg and bacon" 349 ,
"egg sausage and bacon" 351 ,
"egg bacon and spam" 352 ,
"egg bacon sausage and spam" 353 ,
"spam bacon sausage and spam" 354 ,
"spam egg spam spam bacon and spam" 355 ,
"spam sausage spam spam bacon spam tomato and spam");
356 log.
fatal(
"Lobster Thermidor a Crevette with a mornay sauce served in a Provencale manner " 357 "with shallots and aubergines garnished with truffle pate, brandy and with a fried egg on top and spam");
366 CHECK (log.
verifyEvent(
"fatal",
"spam").afterMatch(
"(spam.*){15}"));
370 CHECK (log.
verifyMatch(
"Rec.+fatal").afterMatch(
"\\{.+\\}").
argMatch(
"bacon$",
"and spam$"));
386 CHECK (log.
verify(
"obnoxious").
type(
"EventLogHeader").
on(
"obnoxious"));
389 log.
clear(
"unbearable");
392 CHECK (log.
verify(
"unbearable").
type(
"EventLogHeader").
on(
"unbearable"));
EventMatch & type(string typeID)
refine filter to additionally require a matching log entry type
EventLog & event(string text)
log some text as event
EventLog & warn(string text)
Log a warning entry.
Support for verifying the occurrence of events from unit tests.
EventMatch & beforeCall(string match)
find a match for some function invocation after the current point of reference
Helper to log and verify the occurrence of events.
EventMatch & beforeMatch(string regExp)
find a match with the given regular expression
EventLog & create(string text)
Log the creation of an object.
EventMatch & after(string match)
find a match (substring match) of the given text in an EventLog entry before the current position...
EventMatch & arg(ARGS const &...args)
refine filter to additionally require specific arguments
EventMatch verifyEvent(string match) const
start a query to match for some event.
Implementation namespace for support and library code.
EventMatch & attrib(string key, string valueMatch)
refine filter to additionally match on a specific attribute
EventMatch verifyCall(string match) const
start a query to match especially a function call
EventMatch ensureNot(string match) const
start a query to ensure the given expression does not match.
EventMatch & beforeEvent(string match)
find a match for an "event" after the current point of reference
EventLog & clear()
purge log contents while retaining just the original Header-ID
Simple test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
EventLog & call(string target, string function)
Log occurrence of a function call with no arguments.
EventLog & joinInto(EventLog &otherLog)
Merge this log into another log, forming a combined log.
EventMatch & argPos(size_t idx, ARG const &arg)
refine filter to additionally require match on a specific positional argument
EventMatch & argMatch(ARGS const &...regExps)
refine filter to additionally cover all arguments with a series of regular expressions.
EventMatch & id(string classifier)
refine filter to additionally match on the ID attribute
string instanceTypeID(const TY *const obj)
designation of an distinct object instance
EventMatch & locate(string match)
basic search function: continue linear lookup over the elements of the EventLog to find a match (subs...
EventLog & fatal(string text)
Log a fatal failure.
EventMatch verify(string match) const
start a query to match for some substring.
EventLog & destroy(string text)
Log the destruction of an object.
EventMatch verifyMatch(string regExp) const
start a query to match with a regular expression
EventMatch & on(string targetID)
refine filter to additionally match the 'this' attribute
EventMatch & before(string match)
find a match (substring match) of the given text in an EventLog entry after the current position ...
EventLog & error(string text)
Log an error note.