Commands: test driven stubbing....

This commit is contained in:
Fischlurch 2017-03-31 23:15:29 +02:00
parent a13270a6b8
commit 99d23570cd
3 changed files with 46 additions and 15 deletions

View file

@ -43,7 +43,7 @@
** @see command-def.hpp
** @see command-setup.hpp
** @see command-accessor.hpp
** @see TODO_CommandInstanceManager_test
** @see CommandInstanceManager_test
**
*/
@ -53,11 +53,12 @@
#define CONTROL_COMMAND_INSTANCE_MANAGER_H
#include "lib/error.hpp"
//#include "lib/symbol.hpp"
#include "proc/control/command-dispatch.hpp"
#include "lib/symbol.hpp"
//#include "proc/common.hpp"
#include <boost/noncopyable.hpp>
//#include <string>
#include <string>
@ -65,8 +66,8 @@
namespace proc {
namespace control {
// using std::string;
// using lib::Symbol;
using std::string;
using lib::Symbol;
//using std::shared_ptr;
@ -77,12 +78,16 @@ namespace control {
class CommandInstanceManager
: boost::noncopyable
{
CommandDispatch& dispatcher_;
public:
CommandInstanceManager();
CommandInstanceManager (CommandDispatch&);
~CommandInstanceManager();
Symbol newInstance (Symbol prototypeID, string invocationID);
void dispatch (Symbol instanceID);
bool contains (Symbol instanceID) const;
private:
};

View file

@ -155,12 +155,29 @@ namespace control {
// emit dtors of embedded objects here....
CommandInstanceManager::~CommandInstanceManager() { }
CommandInstanceManager::CommandInstanceManager() { }
CommandInstanceManager::CommandInstanceManager (CommandDispatch& dispatcher)
: dispatcher_{dispatcher}
{ }
/* more to come here...*/
Symbol
CommandInstanceManager::newInstance (Symbol prototypeID, string invocationID)
{
UNIMPLEMENTED ("CommandInstanceManager::newInstance");
}
void
CommandInstanceManager::dispatch (Symbol instanceID)
{
UNIMPLEMENTED ("CommandInstanceManager::dispatch");
}
bool
CommandInstanceManager::contains (Symbol instanceID) const
{
UNIMPLEMENTED ("CommandInstanceManager::contains");
}

View file

@ -26,8 +26,8 @@
#include "lib/test/run.hpp"
#include "proc/control/test-dummy-commands.hpp"
#include "proc/control/command-instance-manager.hpp"
#include "proc/control/command-dispatch.hpp"
//#include "proc/control/command-def.hpp"
#include "lib/format-string.hpp"
#include "lib/format-cout.hpp"
@ -54,8 +54,11 @@ namespace test {
namespace { // Test fixture....
struct Fixture
: CommandDispatch
const Symbol COMMAND_PROTOTYPE = test_Dummy_command1;
const string INVOCATION_ID = "CommandInstanceManager_test";
class Fixture
: public CommandDispatch
{
bool has_commands_in_queue = false;
@ -73,6 +76,13 @@ namespace test {
{
UNIMPLEMENTED("DummyDispatch-Interface: enqueue");
}
public:
bool
contains (Symbol instanceID)
{
UNIMPLEMENTED("contains");
}
};
}
@ -102,8 +112,6 @@ namespace test {
void
verify_standardUsage()
{
UNIMPLEMENTED("standard usage cycle");
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1089
Fixture fixture;
CommandInstanceManager iManager{fixture};
Symbol instanceID = iManager.newInstance(COMMAND_PROTOTYPE, INVOCATION_ID);
@ -118,6 +126,7 @@ namespace test {
CHECK (not iManager.contains (instanceID));
CHECK (fixture.contains (instanceID));
CHECK (Command::canExec(instanceID));
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1089
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1089
}
};