![]() |
Lumiera 0.pre.04~rc.1
»edit your freedom«
|
#include "lib/test/event-log.hpp"
Helper to log and verify the occurrence of events.
The EventLog object is a front-end handle, logging flexible information records into a possibly shared (vector) buffer in heap storage. An extended query DSL allows to write assertions to cover the occurrence of events in unit tests.
Definition at line 275 of file event-log.hpp.
Public Types | |
| using | ArgSeq = lib::diff::RecordSetup< string >::Storage |
| using | Iter = lib::RangeIter< Log::const_iterator > |
| typedef Iter | const_iterator |
| typedef const Entry | value_type |
Public Member Functions | |
| EventLog (string logID) | |
| EventLog (CStr logID) | |
| template<class X > | |
| EventLog (const X *const obj) | |
| string | getID () const |
| EventLog & | joinInto (EventLog &otherLog) |
| Merge this log into another log, forming a combined log. | |
| EventLog & | clear () |
| purge log contents while retaining just the original Header-ID | |
| EventLog & | clear (string alteredLogID) |
| purge log contents and also reset Header-ID | |
| EventLog & | clear (CStr alteredLogID) |
| template<class X > | |
| EventLog & | clear (const X *const obj) |
| EventLog & | event (string text) |
| log some text as event | |
| EventLog & | event (string classifier, string text) |
| log some event, with additional ID or classifier | |
| template<typename... ELMS> | |
| EventLog & | event (string classifier, ELMS const &...initialiser) |
| EventLog & | call (string target, string function) |
| Log occurrence of a function call with no arguments. | |
| EventLog & | call (string target, string function, ArgSeq &&args) |
| Log a function call with a sequence of stringified arguments. | |
| EventLog & | call (CStr target, CStr function, ArgSeq &&args) |
| template<typename... ARGS> | |
| EventLog & | call (string target, string function, ARGS const &...args) |
| Log a function call with arbitrary arguments. | |
| template<class X , typename... ARGS> | |
| EventLog & | call (const X *const targetObj, string function, ARGS const &...args) |
| Log a function call on given object ("`this`")... | |
| template<typename... ARGS> | |
| EventLog & | call (CStr target, string function, ARGS const &...args) |
| template<typename... ELMS> | |
| EventLog & | note (ELMS const &...initialiser) |
| EventLog & | warn (string text) |
| Log a warning entry. | |
| EventLog & | error (string text) |
| Log an error note. | |
| EventLog & | fatal (string text) |
| Log a fatal failure. | |
| EventLog & | create (string text) |
| Log the creation of an object. | |
| EventLog & | destroy (string text) |
| Log the destruction of an object. | |
| template<typename X , typename... ARGS> | |
| EventLog & | addAttrib (string const &key, X &&initialiser, ARGS &&...args) |
| Qualify the latest entry: set further attribute(s) | |
| bool | empty () const |
| const_iterator | begin () const |
| const_iterator | end () const |
| EventMatch | verify (string match) const |
| start a query to match for some substring. | |
| EventMatch | verifyMatch (string regExp) const |
| start a query to match with a regular expression | |
| EventMatch | verifyEvent (string match) const |
| start a query to match for some event. | |
| EventMatch | verifyEvent (string classifier, string match) const |
| start a query to match for an specific kind of element | |
| template<typename X > | |
| EventMatch | verifyEvent (string classifier, X const &something) const |
| 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. | |
Friends | |
| const_iterator | begin (EventLog const &log) |
| const_iterator | end (EventLog const &log) |
| bool | operator== (EventLog const &l1, EventLog const &l2) |
| equality comparison is based on the actual log contents | |
| bool | operator!= (EventLog const &l1, EventLog const &l2) |
Private Member Functions | |
| void | log (std::initializer_list< string > const &ili) |
| template<typename ATTR , typename ARGS > | |
| void | log (Symbol typeID, ATTR &&attribs, ARGS &&args) |
Private Attributes | |
| std::shared_ptr< Log > | log_ |
|
explicit |
Definition at line 604 of file event-log.cpp.
References EventLog::log().
Here is the call graph for this function:Definition at line 301 of file event-log.hpp.
Definition at line 307 of file event-log.hpp.
| using ArgSeq = lib::diff::RecordSetup<string>::Storage |
Definition at line 347 of file event-log.hpp.
| using Iter = lib::RangeIter<Log::const_iterator> |
Definition at line 451 of file event-log.hpp.
| typedef Iter const_iterator |
Definition at line 453 of file event-log.hpp.
| typedef const Entry value_type |
Definition at line 454 of file event-log.hpp.
|
inlineprivate |
Definition at line 282 of file event-log.hpp.
References EventLog::log_.
Referenced by EventLog::EventLog(), EventLog::call(), EventLog::clear(), EventLog::create(), EventLog::destroy(), EventLog::error(), EventLog::event(), EventLog::event(), EventLog::event(), EventLog::fatal(), EventLog::joinInto(), and EventLog::warn().
Here is the caller graph for this function:
|
inlineprivate |
Definition at line 289 of file event-log.hpp.
References EventLog::log_.
|
inline |
Definition at line 317 of file event-log.hpp.
References EventLog::log_.
Referenced by EventLog::clear(), EventLog::joinInto(), ActivityDetector::DiagnosticFun< RET, ARGS >::operator string(), and ActivityDetector::DiagnosticFun< RET, ARGS >::operator()().
Here is the caller graph for this function:Merge this log into another log, forming a combined log.
| otherLog | target to integrate this log's contents into. |
joinInto operation both integrates this logs contents into the other log, and then disconnects from the old storage and connects to the storage of the combined log. joinInto in such a situation, only the current EventLog front-end handle will be rewritten to point to the combined log, while any other clone will continue to point to the original log storage. Definition at line 625 of file event-log.cpp.
References EventLog::getID(), EventLog::log(), and EventLog::log_.
Referenced by TestTracking_test::demonstrate_checkAllocator(), MockElm::joinLog(), MockElm::joinLog(), and EventLog_test::verify_logJoining().
Here is the call graph for this function:
Here is the caller graph for this function:| EventLog & clear | ( | ) |
purge log contents while retaining just the original Header-ID
Definition at line 643 of file event-log.cpp.
References EventLog::clear(), and EventLog::getID().
Referenced by EventLog::clear(), EventLog::clear(), EventLog::clear(), ActivityDetector::clear(), TestTracking_test::demonstrate_checkAllocator(), TestTracking_test::demonstrate_logObject(), LateBindInstance_test::verify_forwarding(), and EventLog_test::verify_logPurging().
Here is the call graph for this function:
Here is the caller graph for this function:| EventLog & clear | ( | string | alteredLogID | ) |
purge log contents and also reset Header-ID
Definition at line 658 of file event-log.cpp.
References EventLog::log(), and EventLog::log_.
Here is the call graph for this function:Definition at line 666 of file event-log.cpp.
References EventLog::clear().
Here is the call graph for this function:Definition at line 338 of file event-log.hpp.
References EventLog::clear(), and lib::idi::instanceTypeID().
Here is the call graph for this function:| EventLog & event | ( | string | text | ) |
log some text as event
Definition at line 676 of file event-log.cpp.
References EventLog::log().
Referenced by MockElm::MockElm(), SimulatedCommandHandler::SimulatedCommandHandler(), MockElm::buildMutator(), TestTracking_test::demonstrate_checkAllocator(), TestTracking_test::demonstrate_logObject(), MockElm::doReset(), ActivityDetector::incrementSeq(), TestMutationTarget::initMutation(), TestMutationTarget::inject(), MockElm::kill(), TestMutationTarget::logAssignment(), TestMutationTarget::logMutation(), TestMutationTarget::logScopeCompletion(), TestMutationTarget::logSkip(), EventLog_test::verify_backwardMatch(), EventLog_test::verify_eventLogging(), LateBindInstance_test::verify_forwarding(), EventLog_test::verify_logJoining(), EventLog_test::verify_negatedMatch(), and EventLog_test::verify_simpleUsage().
Here is the call graph for this function:
Here is the caller graph for this function:| EventLog & event | ( | string | classifier, |
| string | text | ||
| ) |
log some event, with additional ID or classifier
| classifier | info to be saved into the ID attribute |
| text | actual payload info, to be logged as argument |
Definition at line 683 of file event-log.cpp.
References EventLog::log().
Here is the call graph for this function:
|
inline |
Definition at line 360 of file event-log.hpp.
References EventLog::log().
Here is the call graph for this function:| EventLog & call | ( | string | target, |
| string | function | ||
| ) |
Log occurrence of a function call with no arguments.
| target | the object or scope on which the function is invoked |
| function | name of the function being invoked |
Definition at line 690 of file event-log.cpp.
References EventLog::call().
Referenced by MockElm::MockElm(), SimulatedCommandHandler::SimulatedCommandHandler(), Tracker::Tracker(), Tracker::Tracker(), Tracker::Tracker(), Tracker::Tracker(), MockElm::~MockElm(), Tracker::~Tracker(), ZombieNexus::act(), MockElm::buildMutator(), EventLog::call(), EventLog::call(), EventLog::call(), EventLog::call(), EventLog::call(), ZombieNexus::change(), TrackingFactory::create(), TrackingFactory::dispose(), MockElm::doClearErr(), MockElm::doClearMsg(), MockElm::doErr(), MockElm::doExpand(), MockElm::doFlash(), MockElm::doMark(), MockElm::doMsg(), MockElm::doReset(), MockElm::doReveal(), MockElm::kill(), lib::test::anonymous_namespace{tracking-allocator.cpp}::logAlloc(), ZombieNexus::mark(), ZombieNexus::markAll(), ZombieNexus::note(), PlaceholderCommand< ARGS >::operate(), ActivityDetector::DiagnosticFun< RET, ARGS >::operator()(), Tracker::operator=(), Tracker::operator=(), SimulatedCommandHandler::performExec(), SimulatedCommandHandler::performUndo(), ZombieNexus::routeAdd(), ZombieNexus::routeDetach(), PlaceholderCommand< ARGS >::undo(), EventLog_test::verify_callLogging(), and EventLog_test::verify_eventLogging().
Here is the call graph for this function:
Here is the caller graph for this function:Log a function call with a sequence of stringified arguments.
Definition at line 696 of file event-log.cpp.
References EventLog::log().
Here is the call graph for this function:Definition at line 703 of file event-log.cpp.
References EventLog::call().
Here is the call graph for this function:
|
inline |
Log a function call with arbitrary arguments.
Definition at line 380 of file event-log.hpp.
References EventLog::call().
Here is the call graph for this function:
|
inline |
Log a function call on given object ("`this`")...
Definition at line 388 of file event-log.hpp.
References EventLog::call(), and lib::idi::instanceTypeID().
Here is the call graph for this function:
|
inline |
Definition at line 395 of file event-log.hpp.
References EventLog::call().
Here is the call graph for this function:
|
inline |
Definition at line 402 of file event-log.hpp.
References EventLog::log_.
Referenced by MockElm::doClearErr(), MockElm::doClearMsg(), MockElm::doErr(), MockElm::doFlash(), MockElm::doMark(), MockElm::doMsg(), EventLog_test::verify_genericLogging(), and EventLog_test::verify_regExpMatch().
Here is the caller graph for this function:| EventLog & warn | ( | string | text | ) |
Log a warning entry.
Definition at line 710 of file event-log.cpp.
References EventLog::log().
Referenced by SimulatedCommandHandler::SimulatedCommandHandler(), TrackingFactory::dispose(), EventLog_test::verify_genericLogging(), and EventLog_test::verify_logPurging().
Here is the call graph for this function:
Here is the caller graph for this function:| EventLog & error | ( | string | text | ) |
Log an error note.
Definition at line 717 of file event-log.cpp.
References EventLog::log().
Referenced by ZombieNexus::act(), ZombieNexus::change(), TrackingFactory::create(), lib::test::anonymous_namespace{tracking-allocator.cpp}::logAlarm(), ZombieNexus::mark(), ZombieNexus::markAll(), ZombieNexus::note(), ZombieNexus::routeAdd(), ZombieNexus::routeDetach(), and EventLog_test::verify_genericLogging().
Here is the call graph for this function:
Here is the caller graph for this function:| EventLog & fatal | ( | string | text | ) |
Log a fatal failure.
Definition at line 724 of file event-log.cpp.
References EventLog::log().
Referenced by EventLog_test::verify_genericLogging(), and EventLog_test::verify_regExpMatch().
Here is the call graph for this function:
Here is the caller graph for this function:| EventLog & create | ( | string | text | ) |
Log the creation of an object.
Such an entry can be matched as event
Definition at line 733 of file event-log.cpp.
References EventLog::log().
Referenced by MockElm::MockElm(), EventLog_test::verify_genericLogging(), and EventLog_test::verify_logPurging().
Here is the call graph for this function:
Here is the caller graph for this function:| EventLog & destroy | ( | string | text | ) |
Log the destruction of an object.
Can be matched as event.
Definition at line 740 of file event-log.cpp.
References EventLog::log().
Referenced by MockElm::~MockElm(), MockElm::kill(), and EventLog_test::verify_genericLogging().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Qualify the latest entry: set further attribute(s)
Definition at line 431 of file event-log.hpp.
References EventLog::log_.
Referenced by ActivityDetector::DiagnosticFun< RET, ARGS >::operator()().
Here is the caller graph for this function:
|
inline |
Definition at line 445 of file event-log.hpp.
References EventLog::log_.
|
inline |
Definition at line 456 of file event-log.hpp.
References EventLog::log_.
|
inline |
Definition at line 457 of file event-log.hpp.
| EventMatch verify | ( | string | match | ) | const |
start a query to match for some substring.
The resulting matcher object will qualify on any log entry containing the given string. By adding subsequent further query expressions on the returned matcher object, the query can be refined. Moreover it is possible to chain up further search queries, which will be executing starting from the position of the previous match. The final result can be retrieved by bool conversion
Definition at line 752 of file event-log.cpp.
References EventMatch::locate(), and EventLog::log_.
Referenced by BusTerm_test::attachNewBusTerm(), TestTracking_test::demonstrate_checkAllocator(), TestTracking_test::demonstrate_logObject(), TestMutationTarget::verify(), MockElm::verify(), EventLog_test::verify_backwardMatch(), EventLog_test::verify_callLogging(), EventLog_test::verify_eventLogging(), EventLog_test::verify_genericLogging(), EventLog_test::verify_logJoining(), EventLog_test::verify_logPurging(), AbstractTangible_test::verify_mockManipulation(), EventLog_test::verify_regExpMatch(), EventLog_test::verify_simpleUsage(), and MockElm::verifyMark().
Here is the call graph for this function:
Here is the caller graph for this function:| EventMatch verifyMatch | ( | string | regExp | ) | const |
start a query to match with a regular expression
| regExp | definition |
string representation of the log entries. Meaning, it can also match type and attributes Definition at line 761 of file event-log.cpp.
References EventMatch::locateMatch(), and EventLog::log_.
Referenced by EventLog_test::verify_regExpMatch(), TestMutationTarget::verifyMatch(), MockElm::verifyMatch(), Nexus::wasBound(), Nexus::wasInvoked(), and Nexus::wasInvoked().
Here is the call graph for this function:
Here is the caller graph for this function:| EventMatch verifyEvent | ( | string | match | ) | const |
start a query to match for some event.
| match | text to (substring)match against the argument logged as event |
Definition at line 770 of file event-log.cpp.
References EventMatch::locateEvent(), and EventLog::log_.
Referenced by BusTerm_test::attachNewBusTerm(), TestTracking_test::demonstrate_checkAllocator(), EventLog_test::verify_eventLogging(), LateBindInstance_test::verify_forwarding(), EventLog_test::verify_genericLogging(), AbstractTangible_test::verify_mockManipulation(), EventLog_test::verify_regExpMatch(), TestMutationTarget::verifyEvent(), MockElm::verifyEvent(), EventLog::verifyEvent(), TestMutationTarget::verifyEvent(), MockElm::verifyEvent(), MockElm::verifyMark(), MockElm::verifyMark(), and ActivityDetector::verifySeqIncrement().
Here is the call graph for this function:
Here is the caller graph for this function:| EventMatch verifyEvent | ( | string | classifier, |
| string | match | ||
| ) | const |
start a query to match for an specific kind of element
| classifier | select kind of event by match on type or ID |
Definition at line 779 of file event-log.cpp.
References EventMatch::locateEvent(), and EventLog::log_.
Here is the call graph for this function:
|
inline |
Definition at line 501 of file event-log.hpp.
References util::toString(), and EventLog::verifyEvent().
Here is the call graph for this function:| EventMatch verifyCall | ( | string | match | ) | const |
start a query to match especially a function call
| match | text to match against the function name |
Definition at line 788 of file event-log.cpp.
References EventMatch::locateCall(), and EventLog::log_.
Referenced by BusTerm_test::attachNewBusTerm(), BusTerm_test::pushDiff(), EventLog_test::verify_callLogging(), LateBindInstance_test::verify_forwarding(), TestMutationTarget::verifyCall(), MockElm::verifyCall(), and ActivityDetector::verifyInvocation().
Here is the call graph for this function:
Here is the caller graph for this function:| EventMatch ensureNot | ( | string | match | ) | const |
start a query to ensure the given expression does not match.
bool) will be false. Definition at line 805 of file event-log.cpp.
References EventMatch::locate(), EventLog::log_, and EventMatch::look_for_match_.
Referenced by BusTerm_test::attachNewBusTerm(), ActivityDetector::ensureNoInvocation(), TestMutationTarget::ensureNot(), MockElm::ensureNot(), EventLog_test::verify_callLogging(), LateBindInstance_test::verify_forwarding(), EventLog_test::verify_logJoining(), EventLog_test::verify_logPurging(), AbstractTangible_test::verify_mockManipulation(), EventLog_test::verify_negatedMatch(), and EventLog_test::verify_regExpMatch().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 278 of file event-log.hpp.
Referenced by EventLog::addAttrib(), EventLog::begin(), EventLog::clear(), EventLog::empty(), EventLog::ensureNot(), EventLog::getID(), EventLog::joinInto(), EventLog::log(), EventLog::log(), EventLog::note(), EventLog::verify(), EventLog::verifyCall(), EventLog::verifyEvent(), EventLog::verifyEvent(), and EventLog::verifyMatch().
|
friend |
Definition at line 459 of file event-log.hpp.
|
friend |
Definition at line 460 of file event-log.hpp.
equality comparison is based on the actual log contents
Definition at line 520 of file event-log.hpp.
Definition at line 527 of file event-log.hpp.
Collaboration diagram for EventLog: