|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- from ctx import *
- from memory import *
- from memory_Context import *
-
- def ctx_test_Controller_executeFunctions_set(
- ) -> str:
- c = memory_createContext()
- 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" and
- c.outputHelp == "Checked"
- ):
- return "OK: ctx_Controller_executeFunctions_set"
- #}
- return "ERR: ctx_Controller_executeFunctions_set"
- #}
-
- def ctx_test_Controller_processQueue(
- ) -> str:
- c = memory_createContext()
- ctrl = ctx_Controller(c)
- ctrl.registerFunction(__processInput)
- ctrl.set("input", "abc");
- if (
- c.input == "abc" and
- c.outputHelp == "Checked"
- ):
- return "OK: ctx_Controller_processQueue"
- #}
- return "ERR: ctx_Controller_processQueue"
- #}
-
- def ctx_test_memoryContext_field(
- ) -> str:
- c = memory_createContext()
- c.input = "abc"
- if (
- c.field("input") == "abc"
- ):
- return "OK: ctx_memoryContext_field"
- #}
- return "ERR: ctx_memoryContext_field"
- #}
-
- def ctx_test_memoryContext_setField(
- ) -> str:
- 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.
-
- @llm_by_value
- def __processInput(
- c: memory_Context
- ) -> memory_Context:
- if (
- c.recentField == "input"
- ):
- c.outputHelp = "Checked"
- c.recentField = "outputHelp"
- return c
- #}
- c.recentField = "none"
- return c
- #}
|