- from cli import *
- from memory import *
- from memory_Context import *
-
- def cli_test_exit_e(
- ) -> str:
- c = memory_createContext()
- c.input = "e"
- c.recentField = "input"
- c = cli_exit(c)
- if (
- c.recentField == "exit"
- ):
- return "OK: cli_exit_e"
-
- return "ERR: cli_exit_e"
-
-
- def cli_test_exit_exit(
- ) -> str:
- c = memory_createContext()
- c.input = "exit"
- c.recentField = "input"
- c = cli_exit(c)
- if (
- c.recentField == "exit"
- ):
- return "OK: cli_exit_exit"
-
- return "ERR: cli_exit_e"
-
-
- def cli_test_exit_victory(
- ) -> str:
- c = memory_createContext()
- c.playfieldSize = 2
- c.recentField = "playfieldSize"
- c = memory_generateConstPlayfield(c)
-
-
- c.input = "1"
- c.recentField = "input"
- c = cli_selectItem(c)
- c = memory_selectItem(c)
- c.input = "2"
- c.recentField = "input"
- c = cli_selectItem(c)
- c = memory_selectItem(c)
- c = memory_hideMatchingItems(c)
-
-
- c.input = "3"
- c.recentField = "input"
- c = cli_selectItem(c)
- c = memory_selectItem(c)
- c.input = "4"
- c.recentField = "input"
- c = cli_selectItem(c)
- c = memory_selectItem(c)
- c = memory_hideMatchingItems(c)
- c = memory_detectVictory(c)
- c = cli_reportVictory(c)
- c = cli_exit(c)
-
- if (
- c.recentField == "exit"
- ):
- return "OK: cli_exit_victory"
-
- return "ERR: cli_exit_victory"
-
-
- def cli_test_exit_q(
- ) -> str:
- c = memory_createContext()
- c.input = "q"
- c.recentField = "input"
- c = cli_exit(c)
- if (
- c.recentField == "exit"
- ):
- return "OK: cli_exit_q"
-
- return "ERR: cli_exit_q"
-
-
- def cli_test_exit_quit(
- ) -> str:
- c = memory_createContext()
- c.input = "quit"
- c.recentField = "input"
- c = cli_exit(c)
- if (
- c.recentField == "exit"
- ):
- return "OK: cli_exit_quit"
-
- return "ERR: cli_exit_quit"
-
-
- def cli_test_goOn(
- ) -> str:
- c = memory_createContext()
- c.playfieldSize = 2
- c.recentField = "playfieldSize"
- c = memory_generateConstPlayfield(c)
-
-
- c.input = "1"
- c.recentField = "input"
- c = cli_selectItem(c)
- c = memory_selectItem(c)
- c.input = "2"
- c.recentField = "input"
- c = cli_selectItem(c)
- c = memory_selectItem(c)
- c = memory_hideMatchingItems(c)
- c = cli_reportMatchedItems(c)
-
- c = cli_goOn(c)
- if (
- c.recentField == "outputGoOn"
- ):
- return "OK: cli_goOn"
-
- return "ERR: cli_goOn"
-
-
- def cli_test_greetUser(
- ) -> str:
- c = memory_createContext()
- c.didLaunch = True
- c.recentField = "didLaunch"
- c = cli_greetUser(c)
- if (
- c.recentField == "outputGreeting"
- ):
- return "OK: cli_greetUser"
-
- return "ERR: cli_greetUser"
-
-
- def cli_test_promptSecondItemSelection(
- ) -> str:
- c = memory_createContext()
- c.input = "1"
- c.recentField = "input"
- c = cli_selectItem(c)
- c = memory_selectItem(c)
- c = cli_promptSecondItemSelection(c)
- if (
- c.recentField == "outputPromptSelection"
- ):
- return "OK: cli_promptSecondItemSelection"
-
- return "ERR: cli_promptSecondItemSelection"
-
-
- def cli_test_reportMatchedItems(
- ) -> str:
- c = memory_createContext()
- c.playfieldSize = 2
- c.recentField = "playfieldSize"
- c = memory_generateConstPlayfield(c)
- c.input = "1"
- c.recentField = "input"
- c = cli_selectItem(c)
- c = memory_selectItem(c)
- c.input = "2"
- c.recentField = "input"
- c = cli_selectItem(c)
- c = memory_selectItem(c)
- c = memory_hideMatchingItems(c)
- c = cli_reportMatchedItems(c)
- if (
- c.recentField == "outputMatchedItems"
- ):
- return "OK: cli_reportMatchedItems"
-
- return "ERR: cli_reportMatchedItems"
-
-
- def cli_test_reportMismatchedItems(
- ) -> str:
- c = memory_createContext()
- c.playfieldSize = 2
- c.recentField = "playfieldSize"
- c = memory_generateConstPlayfield(c)
- c.input = "1"
- c.recentField = "input"
- c = cli_selectItem(c)
- c = memory_selectItem(c)
- c.input = "3"
- c.recentField = "input"
- c = cli_selectItem(c)
- c = memory_selectItem(c)
- c = memory_detectMismatchedItems(c)
- c = cli_reportMismatchedItems(c)
- if (
- c.recentField == "outputMismatchedItems"
- ):
- return "OK: cli_reportMismatchedItems"
-
- return "ERR: cli_reportMismatchedItems"
-
-
- def cli_test_selectItem(
- ) -> str:
- c = memory_createContext()
- c.input = "1"
- c.recentField = "input"
- c = cli_selectItem(c)
- if (
- c.recentField == "selectedId" and
- c.selectedId == 0
- ):
- return "OK: cli_selectItem"
-
- return "ERR: cli_selectItem"
-
-
- def cli_test_showHelp_h(
- ) -> str:
- c = memory_createContext()
- c.input = "h"
- c.recentField = "input"
- c = cli_showHelp(c)
- if (
- c.recentField == "outputHelp"
- ):
- return "OK: cli_showHelp_h"
-
- return "ERR: cli_showHelp_h"
-
-
- def cli_test_showHelp_help(
- ) -> str:
- c = memory_createContext()
- c.input = "help"
- c.recentField = "input"
- c = cli_showHelp(c)
- if (
- c.recentField == "outputHelp"
- ):
- return "OK: cli_showHelp_help"
-
- return "ERR: cli_showHelp_help"
-
-
- def cli_test_reportVictory(
- ) -> str:
- c = memory_createContext()
- c.playfieldSize = 2
- c.recentField = "playfieldSize"
- c = memory_generateConstPlayfield(c)
-
-
- c.input = "1"
- c.recentField = "input"
- c = cli_selectItem(c)
- c = memory_selectItem(c)
- c.input = "2"
- c.recentField = "input"
- c = cli_selectItem(c)
- c = memory_selectItem(c)
- c = memory_hideMatchingItems(c)
-
-
- c.input = "3"
- c.recentField = "input"
- c = cli_selectItem(c)
- c = memory_selectItem(c)
- c.input = "4"
- c.recentField = "input"
- c = cli_selectItem(c)
- c = memory_selectItem(c)
- c = memory_hideMatchingItems(c)
- c = memory_detectVictory(c)
- c = cli_reportVictory(c)
-
- if (
- c.recentField == "outputVictory"
- ):
- return "OK: cli_reportVictory"
-
- return "ERR: cli_reportVictory"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|