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.

54 lines
1.3KB

  1. from ctx import *
  2. from memory import *
  3. from memory_Context import *
  4. def ctx_test_Python_Controller_registerFieldCallback_match(
  5. ) -> str:
  6. c = memory_createContext()
  7. ctrl = ctx_Controller(c)
  8. c.input = "123"
  9. c.recentField = "input"
  10. globals()["__callbackInput"] = ""
  11. ctrl.registerFieldCallback("input", __setCallbackInput)
  12. ctrl.reportContext()
  13. val = globals()["__callbackInput"]
  14. if (
  15. c.input == globals()["__callbackInput"]
  16. ):
  17. return "OK: ctx_Python_Controller_registerFieldCallback_match"
  18. #}
  19. return f"ERR: ctx_Python_Controller_registerFieldCallback_match"
  20. #}
  21. def ctx_test_Python_Controller_registerFieldCallback_mismatch(
  22. ) -> str:
  23. c = memory_createContext()
  24. ctrl = ctx_Controller(c)
  25. c.input = "123"
  26. c.outputHelp = "you"
  27. c.recentField = "outputHelp"
  28. globals()["__callbackInput"] = ""
  29. ctrl.registerFieldCallback("input", __setCallbackInput)
  30. ctrl.reportContext()
  31. val = globals()["__callbackInput"]
  32. if (
  33. globals()["__callbackInput"] == ""
  34. ):
  35. return "OK: ctx_Python_Controller_registerFieldCallback_mismatch"
  36. #}
  37. return f"ERR: ctx_Python_Controller_registerFieldCallback_mismatch"
  38. #}
  39. # Auxiliary.
  40. __callbackInput = ""
  41. @llm_by_value
  42. def __setCallbackInput(c):
  43. if (
  44. c.recentField == "input"
  45. ):
  46. globals()["__callbackInput"] = c.input
  47. #}
  48. #}