diff --git a/src/lib/symbol.hpp b/src/lib/symbol.hpp index 179e4e7ad..2c96dc8d1 100644 --- a/src/lib/symbol.hpp +++ b/src/lib/symbol.hpp @@ -42,6 +42,7 @@ #define LIB_SYMBOL_H #include "lib/hash-standard.hpp" +#include "include/logging.h" /////////////TODO only temporarily #include #include @@ -100,6 +101,25 @@ namespace lib { Symbol (Symbol const& o) : Literal(o) { } + + Symbol (Literal const& base, std::string ext) + : Literal(NULL) + { + UNIMPLEMENTED ("symbol table"); + } + + Symbol (Literal const& base, Literal ext) + : Literal(NULL) + { + UNIMPLEMENTED ("symbol table"); + } + + explicit + Symbol (std::string definition) + : Literal(NULL) + { + UNIMPLEMENTED ("symbol table"); + } Symbol& operator= (Literal const& otherSym) diff --git a/tests/core/proc/control/command-instance-manager-test.cpp b/tests/core/proc/control/command-instance-manager-test.cpp index cf5009317..1e5fddc5a 100644 --- a/tests/core/proc/control/command-instance-manager-test.cpp +++ b/tests/core/proc/control/command-instance-manager-test.cpp @@ -50,6 +50,7 @@ namespace test { using std::move; using std::rand; + using lumiera::error::LUMIERA_ERROR_LIFECYCLE; @@ -279,11 +280,41 @@ namespace test { } - /** @test */ + /** @test verify sane command lifecycle is enforced + * - instance need to be opened (created) prior to access + * - can not dispatch an instance not yet created + * - can not create new instance before dispatching the existing one + * - can not dispatch an instance before binding its arguments + * - can not access an instance already dispatched + */ void verify_lifecycle() { - UNIMPLEMENTED ("lifecycle sanity"); + Fixture fixture; + CommandInstanceManager iManager{fixture}; + + Symbol instanceID{COMMAND_PROTOTYPE, INVOCATION_ID}; + VERIFY_ERROR (INVALID_COMMAND, iManager.getInstance (instanceID)); + VERIFY_ERROR (LIFECYCLE, iManager.dispatch (instanceID)); + + Symbol i2 = iManager.newInstance (COMMAND_PROTOTYPE, INVOCATION_ID); + CHECK (i2 == instanceID); + CHECK (iManager.getInstance (instanceID)); + + Command cmd = iManager.getInstance (instanceID); + CHECK (cmd); + CHECK (not cmd.canExec()); + + VERIFY_ERROR (UNBOUND_ARGUMENTS, iManager.dispatch (instanceID)); + VERIFY_ERROR (DUPLICATE_COMMAND, iManager.newInstance (COMMAND_PROTOTYPE, INVOCATION_ID)); + + cmd.bind(23); + CHECK (cmd.canExec()); + iManager.dispatch (instanceID); + + CHECK (not iManager.contains (instanceID)); + VERIFY_ERROR (INVALID_COMMAND, iManager.getInstance (instanceID)); + CHECK (instanceID == iManager.newInstance (COMMAND_PROTOTYPE, INVOCATION_ID)); } };