Михаил Капелько 5 months ago
parent
commit
db12076b45
5 changed files with 30 additions and 11 deletions
  1. +0
    -8
      v4/ctx.h
  2. +24
    -1
      v4/ctx_test2.cpp
  3. +2
    -0
      v4/ctx_test2.h
  4. +4
    -0
      v4/main.cpp
  5. +0
    -2
      v4/memory_Context.cpp

+ 0
- 8
v4/ctx.h View File

@@ -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);


+ 24
- 1
v4/ctx_test2.cpp View File

@@ -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";
}

+ 2
- 0
v4/ctx_test2.h View File

@@ -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

+ 4
- 0
v4/main.cpp View File

@@ -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()


+ 0
- 2
v4/memory_Context.cpp View File

@@ -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;


Loading…
Cancel
Save