diff --git a/src/proc/control/command-queue.hpp b/src/proc/control/command-queue.hpp index 721c4f70d..23e19ba55 100644 --- a/src/proc/control/command-queue.hpp +++ b/src/proc/control/command-queue.hpp @@ -41,7 +41,7 @@ #ifndef PROC_CONTROL_COMMAND_QUEUE_H #define PROC_CONTROL_COMMAND_QUEUE_H -#include "lib/error.hpp" ////////TODO needed? +#include "proc/control/command.hpp" //#include "common/subsys.hpp" //#include "lib/depend.hpp" diff --git a/tests/core/proc/control/command-queue-test.cpp b/tests/core/proc/control/command-queue-test.cpp index 8867dc617..1e550b5ea 100644 --- a/tests/core/proc/control/command-queue-test.cpp +++ b/tests/core/proc/control/command-queue-test.cpp @@ -23,11 +23,12 @@ #include "lib/test/run.hpp" #include "proc/control/command-queue.hpp" -//#include "proc/control/command.hpp" +#include "proc/control/command-def.hpp" //#include "proc/control/command-registry.hpp" //#include "lib/test/event-log.hpp" +#include "lib/symbol.hpp" -//#include "proc/control/test-dummy-commands.hpp" +#include "proc/control/test-dummy-commands.hpp" //#include @@ -39,10 +40,13 @@ namespace test { // using std::function; // using std::rand; + using lib::Symbol; namespace { // test fixture... + const Symbol COMMAND_1{"test.queue.command1"}; + const Symbol COMMAND_3{"test.queue.command3"}; }//(End) test fixture @@ -67,7 +71,29 @@ namespace test { class CommandQueue_test : public Test { + //------------------FIXTURE + public: + CommandQueue_test() + { + CommandDef (COMMAND_1) + .operation (command1::operate) + .captureUndo (command1::capture) + .undoOperation (command1::undoIt) + ; + CommandDef (COMMAND_3) + .operation (command3::operate) + .captureUndo (command3::capture) + .undoOperation (command3::undoIt) + ; + } + ~CommandQueue_test() + { + Command::remove (COMMAND_1); + Command::remove (COMMAND_3); + } + //-------------(End)FIXTURE + virtual void run (Arg) { diff --git a/tests/core/proc/control/command-use2-test.cpp b/tests/core/proc/control/command-use2-test.cpp index 3e5bb5bf5..a63092b53 100644 --- a/tests/core/proc/control/command-use2-test.cpp +++ b/tests/core/proc/control/command-use2-test.cpp @@ -119,7 +119,7 @@ namespace test { check_defaultHandlingPattern(); // check_ThrowOnError(); //////////////////////////////////////////////////////////////////////TICKET #211 -// check_DispatcherInvocation() // yet to be written as of 1/2016 + check_DispatcherInvocation(); Command::remove ("test.command2"); @@ -198,6 +198,14 @@ namespace test { com2.undo(); CHECK (!protocolled(randVal_)); } + + + + void + check_DispatcherInvocation() + { + UNIMPLEMENTED("start the dispatcher and enqueue a rigged special command"); /////////////////////////////TICKET #209 + } }; diff --git a/tests/core/proc/control/command-use3-test.cpp b/tests/core/proc/control/command-use3-test.cpp index 32c6ffe9b..350fdb936 100644 --- a/tests/core/proc/control/command-use3-test.cpp +++ b/tests/core/proc/control/command-use3-test.cpp @@ -60,6 +60,8 @@ namespace test { * asynchronous or repeated invocation and command sequence bundles. * * @todo planned but not implemented as of 7/09 + * @todo as of 12/2016 I doubt we'll get asynchronous invocation + * but command sequence bundles still seem a reasonable future idea * * @see HandlingPattern */ diff --git a/tests/core/proc/control/handling-pattern-basics-test.cpp b/tests/core/proc/control/handling-pattern-basics-test.cpp index 0bd3e686f..004c47dc7 100644 --- a/tests/core/proc/control/handling-pattern-basics-test.cpp +++ b/tests/core/proc/control/handling-pattern-basics-test.cpp @@ -170,6 +170,7 @@ namespace test { } + /** @test verify the Handling pattern API: execute a command */ void checkExec (PCommandImpl com) { @@ -177,8 +178,8 @@ namespace test { CHECK (!com->canExec()); typedef Types ArgType; - const int ARGU (1 + rand() % 1000); - Tuple tuple(ARGU); + const int ARGR (1 + rand() % 1000); + Tuple tuple(ARGR); TypedArguments> arg(tuple); com->setArguments(arg); @@ -190,11 +191,12 @@ namespace test { ExecResult res = patt.exec (*com, TEST_CMD); CHECK (res); - CHECK (ARGU == command1::check_); + CHECK (ARGR == command1::check_); CHECK (com->canUndo()); } + /** @test verify the Handling pattern API: undo a command */ void checkUndo (PCommandImpl com) { @@ -212,6 +214,9 @@ namespace test { } + /** @test use custom implementation of the HandlingPattern interface, + * rigged to verify the functions are actually invoked. + */ void useCustomHandler (PCommandImpl com) { diff --git a/tests/core/proc/control/test-dummy-commands.hpp b/tests/core/proc/control/test-dummy-commands.hpp index 7636c654a..ef90c0873 100644 --- a/tests/core/proc/control/test-dummy-commands.hpp +++ b/tests/core/proc/control/test-dummy-commands.hpp @@ -25,7 +25,7 @@ ** Some dummy command functions used for building unit test cases. ** Any of these functions comes in triples of operation function, undo state ** capturing function and UNDO function. They are placed into a nested test - ** namespace, together with some global variables used as a backdoor to + ** namespace, together with some global variables, usable as backdoor to ** verify the effect of calling these functions. ** ** @see command-use1-test.cpp @@ -86,7 +86,7 @@ namespace test { - namespace command2 { ///< test command writing to protocol and possibly throwing + namespace command2 { ///< test command writing capturing log and possibly throwing using lumiera::error::External; @@ -125,7 +125,7 @@ namespace test { - namespace command3 { ///< test command taking zero arguments + namespace command3 { ///< test command with zero arguments extern ulong check_;