Research portable Memory game | Исследовать портируемую игру Память
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ctx_test.py 1.6KB

5 mesi fa
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. from ctx import *
  2. from memory import *
  3. from memory_Context import *
  4. def ctx_test_Controller_executeFunctions_set(
  5. ) -> str:
  6. c = memory_createContext()
  7. ctrl = ctx_Controller(c)
  8. # Disable automatic invocation of executeFunctions.
  9. ctrl.isProcessingQueue = True
  10. ctrl.set("input", "123")
  11. ctrl.registerFunction(__processInput)
  12. # Apply 'input'.
  13. ctrl.executeFunctions()
  14. # Apply 'outputHelp'.
  15. ctrl.executeFunctions()
  16. if (
  17. c.input == "123" and
  18. c.outputHelp == "Checked"
  19. ):
  20. return "OK: ctx_Controller_executeFunctions_set"
  21. #}
  22. return "ERR: ctx_Controller_executeFunctions_set"
  23. #}
  24. def ctx_test_Controller_processQueue(
  25. ) -> str:
  26. c = memory_createContext()
  27. ctrl = ctx_Controller(c)
  28. ctrl.registerFunction(__processInput)
  29. ctrl.set("input", "abc");
  30. if (
  31. c.input == "abc" and
  32. c.outputHelp == "Checked"
  33. ):
  34. return "OK: ctx_Controller_processQueue"
  35. #}
  36. return "ERR: ctx_Controller_processQueue"
  37. #}
  38. def ctx_test_memoryContext_field(
  39. ) -> str:
  40. c = memory_createContext()
  41. c.input = "abc"
  42. if (
  43. c.field("input") == "abc"
  44. ):
  45. return "OK: ctx_memoryContext_field"
  46. #}
  47. return "ERR: ctx_memoryContext_field"
  48. #}
  49. def ctx_test_memoryContext_setField(
  50. ) -> str:
  51. c = memory_createContext()
  52. c.input = "abc"
  53. c.setField("input", "123")
  54. if (
  55. c.field("input") == "123"
  56. ):
  57. return "OK: ctx_memoryContext_setField"
  58. #}
  59. return "ERR: ctx_memoryContext_setField"
  60. #}
  61. # Auxiliary functions.
  62. @llm_by_value
  63. def __processInput(c):
  64. if (
  65. c.recentField == "input"
  66. ):
  67. c.outputHelp = "Checked"
  68. c.recentField = "outputHelp"
  69. return c
  70. #}
  71. c.recentField = "none"
  72. return c
  73. #}