42using std::ostringstream;
54 using LERR_(MISSING_MEMENTO);
91 return tra1.element_ ==
tra2.element_;
96 int Tracker<TY>::instanceCnt (0);
109 return i1.i5i ==
i2.i5i;
120 static _Fmt fmt (
"doIt( Time=%s \"%s\" rand=%2d )");
121 cout <<
"invoke operation..." << endl;
128 cout <<
"capture state..." << endl;
135 cout <<
"undo... memento=" << memento << endl;
136 protocol <<
"undoIt(time="<<
time<<
")----memento-:"<< *memento;
155 TODO (
"implement serialisation/de-serialisation-Check");
156 cout <<
"would be serialised....." <<
clo << endl;
165 return 10 + rani(90);
192 Tracker<TimeVar>::instanceCnt = 0;
193 Tracker<string>::instanceCnt = 0;
202 CHECK (0 == Tracker<TimeVar>::instanceCnt);
203 CHECK (0 == Tracker<string>::instanceCnt);
237 for_each (
tup, showIt);
239 arg1->storeTuple (std::tuple<>());
240 arg2->storeTuple (make_tuple (rani(10)));
241 arg3->storeTuple (make_tuple (rani(10),
TimeVar(randTime())));
242 arg4->storeTuple (make_tuple (rani(10),
TimeVar(randTime())));
244 arg5->storeTuple (make_tuple (
TTime (randTime()),
Tstr(
"glorious"), twoRandomDigits() ));
248 arg5->tie(undoIt, captureState)
253 CHECK (*
arg5->memento() ==
"destruction");
257 for_each (
tup, showIt);
268 for_each (
tup, checkSerialisation);
285 cout << showSizeof(
args) << endl;
289 make_tuple (
TTime(randTime()),
Tstr(
"Lumiera rocks"), twoRandomDigits() ));
291 cout <<
args << endl;
312 protocol <<
"START...";
315 cout <<
"captured state: " <<
args.memento() << endl;
319 cout <<
args << endl;
322 cout << protocol.str() << endl;
324 cout << protocol.str() << endl;
330 protocol <<
"RESET...";
334 cout <<
"modified: " <<
args << endl;
335 cout <<
"copied : " <<
argsCopy << endl;
338 cout << protocol.str() << endl;
Simple vector based collection of pointers, managing lifecycle of the pointed-to objects.
basic constant internal time value.
a mutable time value, behaving like a plain number, allowing copy and re-accessing
Lumiera's internal time value datatype.
virtual void invoke(CmdFunctor const &)=0
invoke functor using the stored parameter values
This is "the" top level CmdClosure implementation.
void createTuples(ArgTuples &tup)
void serialiseArgTuples(ArgTuples &tup)
void simulateCmdLifecycle()
A front-end for using printf-style formatting.
A passive container record holding the actual command arguments & UNDO state.
string showSizeof(size_t siz, string name)
for printing sizeof().
lib::time::Time randTime()
create a random but not insane Time value between 1s ... 10min + 500ms
void undoIt(Tracker< TimeVar > time, Tracker< string >, int, Tracker< string > memento)
void showIt(CmdClosure &clo)
ostringstream protocol
used to verify the test function calls
void checkSerialisation(CmdClosure &clo)
void doIt(Tracker< TimeVar > time, Tracker< string > str, int rand)
void dummyU(int, int, int)
another dummy-UNDO function
Tracker< string > captureState(Tracker< TimeVar >, Tracker< string > xstr, int)
FunErasure< StoreFunction > CmdFunctor
A neutral container internally holding the functor used to implement the Command.
Steam-Layer implementation namespace root.
Test runner and basic definitions for tests.
std::string toString(TY const &val) noexcept
get some string representation of any object, reliably.
disable_if< can_IterForEach< Container >, FUN > for_each(Container const &coll, FUN doIt)
operate on all elements of a STL container.
bool isnil(lib::time::Duration const &dur)
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Managing lifecycle for a collection of objects.
Dummy custom memento datatype.
watching the instance creation of some parameter values
Tracker(Tracker const &otr)
A collection of frequently used helper functions to support unit testing.
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
Perform operations "for each element" of a collection.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...