|
-
- #include <map>
- #include <string>
- #include <vector>
- #include "ctx.h"
- #include "llm.h"
- #include "memory_Context.h"
- #include "main.h"
-
- std::string ctx_test_Controller_executeFunctions_set(
- ) {
- auto c = memory_createContext();
- auto ctrl = ctx_Controller(c);
- // Disable automatic invocation of executeFunctions.
- ctrl.isProcessingQueue = true;
- ctrl.set("input", "123");
- ctrl.registerFunction(__processInput);
- // Apply 'input'.
- ctrl.executeFunctions();
- // Apply 'outputHelp'.
- ctrl.executeFunctions();
- if (
- c.input == "123" &&
- c.outputHelp == "Checked"
- ) {
- return "OK: ctx_Controller_executeFunctions_set";
- }
- return "ERR: ctx_Controller_executeFunctions_set";
- }
-
- std::string ctx_test_Controller_processQueue(
- ) {
- auto c = memory_createContext();
- auto ctrl = ctx_Controller(c);
- ctrl.registerFunction(__processInput);
- ctrl.set("input", "abc");;
- if (
- c.input == "abc" &&
- c.outputHelp == "Checked"
- ) {
- return "OK: ctx_Controller_processQueue";
- }
- return "ERR: ctx_Controller_processQueue";
- }
-
- std::string ctx_test_memoryContext_field(
- ) {
- auto c = memory_createContext();
- c.input = "abc";
- if (
- c.field("input") == "abc"
- ) {
- return "OK: ctx_memoryContext_field";
- }
- return "ERR: ctx_memoryContext_field";
- }
-
- std::string ctx_test_memoryContext_setField(
- ) {
- auto c = memory_createContext();
- c.input = "abc";
- c.setField("input", "123");
- if (
- c.field("input") == "123"
- ) {
- return "OK: ctx_memoryContext_setField";
- }
- return "ERR: ctx_memoryContext_setField";
- }
-
- // Auxiliary functions.
-
- memory_Context __processInput(
- memory_Context c
- ) {
- if (
- c.recentField == "input"
- ) {
- c.outputHelp = "Checked";
- c.recentField = "outputHelp";
- return c;
- }
- c.recentField = "none";
- return c;
- }
|