38 string TEST_CMD =
"test.command1.handling";
39 HandlingPattern::ID TEST_PATTERN = HandlingPattern::DUMMY;
54 log_.
call (TEST_CMD,
"exec");
55 command.invokeCapture();
56 command.invokeOperation();
62 log_.call (TEST_CMD,
"undo");
67 isValid()
const override 77 return log_.verifyCall(
"exec").on(TEST_CMD);
83 return log_.verifyCall(
"undo").on(TEST_CMD)
121 cnt_inst = registry.instance_count();
124 PCommandImpl pCom = buildTestCommand(registry);
128 useCustomHandler (pCom);
131 CHECK (cnt_inst == registry.instance_count());
144 typedef void Sig_oper(
int);
145 typedef long Sig_capt(
int);
146 typedef void Sig_undo(
int,
long);
148 function<Sig_oper> o_Fun (command1::operate);
149 function<Sig_capt> c_Fun (command1::capture);
150 function<Sig_undo> u_Fun (command1::undoIt);
152 CHECK (o_Fun && c_Fun && u_Fun);
169 CHECK (!com->canExec());
172 const int ARGR{1 +
rani (1000)};
175 com->setArguments(arg);
177 CHECK (com->canExec());
178 CHECK (!com->canUndo());
179 command1::check_ = 0;
185 CHECK (ARGR == command1::check_);
186 CHECK (com->canUndo());
195 CHECK (com->canExec());
196 CHECK (com->canUndo());
198 CHECK (command1::check_ > 0);
204 CHECK (command1::check_ == 0);
214 CustomHandler specialHandler;
216 CHECK (com->canExec());
217 CHECK (not specialHandler.invokedExec());
219 specialHandler.exec (*com, TEST_CMD);
220 CHECK ( specialHandler.invokedExec());
221 CHECK (not specialHandler.invokedUndo());
223 specialHandler.undo (*com, TEST_CMD);
224 CHECK ( specialHandler.invokedExec());
typename BuildTupleType< TYPES >::Type Tuple
Build a std::tuple from types given as type sequence.
Support for verifying the occurrence of events from unit tests.
Implementation helper to bind Steam-Layer commands with arbitrary argument tuples.
shared_ptr< CommandImpl > newCommandImpl(function< SIG_OPER > &operFunctor, function< SIG_CAPT > &captFunctor, function< SIG_UNDO > &undoFunctor)
set up a new command implementation frame
Top level of the command implementation.
Helper to log and verify the occurrence of events.
Managing command definitions and the storage of individual command objects.
int rani(uint bound=_iBOUND())
Registry managing command implementation objects (Singleton).
Steam-Layer implementation namespace root.
PCommandImpl buildTestCommand(CommandRegistry ®istry)
create a command implementation frame usable for tests.
Simplistic test class runner.
Result (Status) of command execution.
EventLog & call(string target, string function)
Log occurrence of a function call with no arguments.
Steam-Layer command frontend.
void useCustomHandler(PCommandImpl com)
Pre-defined command execution skeletons.
Some dummy command functions used for building unit test cases.
Steam-Layer Command implementation.
static HandlingPattern const & get(ID id)
retrieve the pre-configured pattern
void checkUndo(PCommandImpl com)
void checkExec(PCommandImpl com)
Interface: Operation Skeleton how to invoke or undo a command.
static lib::Depend< CommandRegistry > instance
storage for the singleton factory used to access CommandRegistry