37 using std::regex_replace;
59 operate (
string search,
string replace)
65 capture (
string,
string)
71 undoIt (
string,
string,
string oldVal)
81 def.operation(operate)
83 .undoOperation(undoIt);
117 Literal empty_text = def_empty;
118 CHECK (empty_text ==
"to be or not to be");
119 CHECK (
sizeof(def_empty) ==
sizeof(
Literal));
120 CHECK (
sizeof(def_empty) ==
sizeof(
char*));
122 CStr actualContent =
reinterpret_cast<char*&
>(def_empty);
123 CHECK (actualContent == empty_text);
126 CHECK (
string(def_empty) ==
string(empty_text));
129 CHECK (def_empty ==
CommandSetup(
"to be or not to be"));
130 CHECK (def_empty !=
CommandSetup(
"to pee or not to pee"));
140 def_0 = do_something_pointless;
147 def.operation (operate)
148 .captureUndo (capture)
149 .undoOperation (undoIt);
155 def.operation ([&](
uint cnt)
159 .captureUndo ([](
uint) ->
string
163 .undoOperation ([](
uint,
string oldVal)
177 CHECK (isnil (testString));
181 CHECK (testString ==
"Ichthyostega wuz here");
192 Command com1{
"test.CommandSetup.def_1"};
193 Command com2{
"test.CommandSetup.def_2"};
195 com1.
bind (
string{
"^(\\w+)"},
string{
"No $1"});
196 com2.bind (
uint(42));
198 CHECK (testString ==
"Ichthyostega wuz here");
200 CHECK (testString ==
"No Ichthyostega wuz here");
203 CHECK (testString ==
"No Ichthyostega wuz here 42 times.");
206 CHECK (testString ==
"Ichthyostega wuz here");
229 Command{test_CommandSetup_test}
234 CHECK (not c1.canExec());
235 CHECK (not c2.canExec());
237 c1.bind (
string{
"wuz.*"},
string{
"the Devonian"});
238 c2.bind (
string{
"\\s*\\w+$"},
string{
""});
239 CHECK (c1.canExec());
240 CHECK (c2.canExec());
243 CHECK (testString ==
"Ichthyostega wuz here");
246 CHECK (testString ==
"Ichthyostega the Devonian");
249 CHECK (testString ==
"Ichthyostega the");
252 CHECK (testString ==
"Ichthyostega");
255 CHECK (testString ==
"");
258 CHECK (testString ==
"Ichthyostega wuz here");
void verify_standardUsage()
void verify_DefinitionRegistration()
void verify_DefinitionSetup()
Helper class used solely for defining a Command-Object.
Marker and Helper for writing Steam-Layer Command definitions.
static size_t pendingCnt()
diagnostics / test
static void invokeDefinitionClosures()
Handle object representing a single Command instance to be used by client code.
static bool defined(Symbol cmdID)
static bool remove(Symbol cmdID)
Command storeDef(Symbol newCmdID) const
create a clone definition
A front-end for using printf-style formatting.
Common ID definitions for Steam-Layer commands.
Actually defining a command and binding it to execution parameters.
#define COMMAND_DEFINITION(_NAME_)
Macro to write command definitions in a compact form.
void do_something_pointless(CommandDef &)
string testString
will be manipulated by the commands we define
Steam-Layer implementation namespace root.
Test runner and basic definitions for tests.
bool isnil(lib::time::Duration const &dur)
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
RET bind()
Accept dummy binding (0 Arg)
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...