d
This commit is contained in:
8
v4/ctx.h
8
v4/ctx.h
@@ -65,14 +65,6 @@ template <class T> class ctx_Controller {
|
||||
callbacks.push_back(execCB);
|
||||
}
|
||||
|
||||
/*
|
||||
void registerFunctions(const std::list<T *(T)> funcs) {
|
||||
for (const auto &f : funcs) {
|
||||
functions.push_back(f);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
void reportContext() {
|
||||
for (const auto &cb : callbacks) {
|
||||
cb(context);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <string>
|
||||
#include "any.h"
|
||||
#include "ctx.h"
|
||||
#include "memory_Context.h"
|
||||
#include <iostream>
|
||||
|
||||
std::string s(const char *str) {
|
||||
return std::string(str);
|
||||
@@ -116,3 +116,26 @@ std::string test_ctx_Controller_registerFieldCallback_mismatch() {
|
||||
}
|
||||
return "ERR: ctx_Controller_registerFieldCallback_mismatch";
|
||||
}
|
||||
|
||||
std::string test_memory_Context_field() {
|
||||
auto c = memory_createContext();
|
||||
c.input = "abc";
|
||||
if (
|
||||
libany::any_cast<std::string>(c.field("input")) == "abc"
|
||||
) {
|
||||
return "OK: memory_Context_field";
|
||||
}
|
||||
return "ERR: memory_Context_field";
|
||||
}
|
||||
|
||||
std::string test_memory_Context_setField() {
|
||||
auto c = memory_createContext();
|
||||
c.input = "abc";
|
||||
c.setField("input", s("123"));
|
||||
if (
|
||||
c.input == "123"
|
||||
) {
|
||||
return "OK: memory_Context_setField";
|
||||
}
|
||||
return "ERR: memory_Context_setField";
|
||||
}
|
||||
|
||||
@@ -7,5 +7,7 @@ std::string test_ctx_Controller_executeFunctions_set();
|
||||
std::string test_ctx_Controller_processQueue();
|
||||
std::string test_ctx_Controller_registerFieldCallback_match();
|
||||
std::string test_ctx_Controller_registerFieldCallback_mismatch();
|
||||
std::string test_memory_Context_field();
|
||||
std::string test_memory_Context_setField();
|
||||
|
||||
#endif // ctx_test_HEADER
|
||||
|
||||
@@ -15,6 +15,10 @@ int main() {
|
||||
<< std::endl
|
||||
<< test_ctx_Controller_registerFieldCallback_mismatch()
|
||||
<< std::endl
|
||||
<< test_memory_Context_field()
|
||||
<< std::endl
|
||||
<< test_memory_Context_setField()
|
||||
<< std::endl
|
||||
<< llm_test_isDigit_digit()
|
||||
<< std::endl
|
||||
<< llm_test_isDigit_notDigit()
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
#include "any.h"
|
||||
#include "memory_Context.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
libany::any memory_Context::field(const std::string &fieldName) {
|
||||
if (fieldName == "didLaunch") {
|
||||
return didLaunch;
|
||||
|
||||
Reference in New Issue
Block a user