|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- 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)
-
- # Match the first pair of tiles.
- 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)
-
- # Match the second pair of tiles.
- 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)
-
- # Match the first pair of items.
- 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)
-
- # Match the first pair of tiles.
- 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)
-
- # Match the second pair of tiles.
- 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"
- #}
-
- #def cli_test_shouldReportIvalidItemSelection_outOfBoundsMin(
- #) -> str:
- # c = cli_createContext()
- # c.cMemory = memory_createContext()
- # c.input = "0"
- # c = cli_selectItem(c)
- # c = cli_shouldReportInvalidItemSelection(c)
- # if (
- # c.recentField == "outputInvalidItemSelection"
- # ):
- # return "OK: cli_shouldReportInvalidItemSelection"
- # #}
- # return "ERR: cli_shouldReportInvalidItemSelection"
- ##}
- #
|