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.
|
- #include <string>
- #include "ctx.h"
- #include "memory_Context.h"
-
- #include <iostream>
-
- std::string ctx_test_Controller_executeFunctions_set() {
- auto c = memory_createContext();
- ctx_Controller<memory_Context> ctrl(c);
- // Disable automatic invocation of executeFunctions.
- ctrl.isProcessingQueue = true;
- std::cout << "01\n";
- ctrl.set("input", "123");
- std::cout << "input: '" << ctrl.context.input << "'" << std::endl;
- std::cout << "02\n";
-
- auto processInput = [](memory_Context c) -> memory_Context {
- if (c.recentField == "input") {
- c.outputHelp = "Checked";
- c.recentField = "outputHelp";
- return c;
- }
- c.recentField = "none";
- return c;
- };
-
- ctrl.registerFunction(processInput);
- // Apply 'input'.
- ctrl.executeFunctions();
- // Apply 'outputHelp'.
- ctrl.executeFunctions();
- std::cout << "input: '" << ctrl.context.input << "'" << std::endl;
- if (
- ctrl.context.input == "123" &&
- ctrl.context.outputHelp == "Checked"
- ) {
- return "OK: ctx_Controller_executeFunctions_set";
- }
- return "ERR: ctx_Controller_executeFunctions_set";
- }
|