58 verify_backwardMatch();
59 verify_negatedMatch();
62 verify_eventLogging();
63 verify_genericLogging();
81 CHECK (not log.
verify(
"γ"));
93 verify_backwardMatch ()
115 verify_negatedMatch ()
146 log1.
event(
"baked beans");
159 CHECK (copy.verify(
"ham").before(
"eggs").before(
"bacon"));
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");
177 CHECK (copy.ensureNot(
"logJoin"));
178 CHECK (copy.ensureNot(
"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})"));
204 verify_callLogging ()
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"));
263 verify_eventLogging ()
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 )"));
287 verify_genericLogging ()
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})"));
336 verify_regExpMatch ()
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");
357 CHECK (log.
verifyEvent(
"fatal",
"spam").afterMatch(
"(spam.*){15}"));
361 CHECK (log.
verifyMatch(
"Rec.+fatal").afterMatch(
"\\{.+\\}").
argMatch(
"bacon$",
"and spam$"));
377 CHECK (log.
verify(
"obnoxious").
type(
"EventLogHeader").
on(
"obnoxious"));
380 log.
clear(
"unbearable");
383 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
Simplistic 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.