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.

174 lines
3.3KB

  1. from cli import *
  2. from memory import *
  3. from memory_Context import *
  4. def cli_test_exit_e(
  5. ) -> str:
  6. c = memory_createContext()
  7. c.input = "e"
  8. c.recentField = "input"
  9. c = cli_exit(c)
  10. if (
  11. c.recentField == "exit"
  12. ):
  13. return "OK: cli_exit_e"
  14. #}
  15. return "ERR: cli_exit_e"
  16. #}
  17. def cli_test_exit_exit(
  18. ) -> str:
  19. c = memory_createContext()
  20. c.input = "exit"
  21. c.recentField = "input"
  22. c = cli_exit(c)
  23. if (
  24. c.recentField == "exit"
  25. ):
  26. return "OK: cli_exit_exit"
  27. #}
  28. return "ERR: cli_exit_e"
  29. #}
  30. def cli_test_exit_q(
  31. ) -> str:
  32. c = memory_createContext()
  33. c.input = "q"
  34. c.recentField = "input"
  35. c = cli_exit(c)
  36. if (
  37. c.recentField == "exit"
  38. ):
  39. return "OK: cli_exit_q"
  40. #}
  41. return "ERR: cli_exit_q"
  42. #}
  43. def cli_test_exit_quit(
  44. ) -> str:
  45. c = memory_createContext()
  46. c.input = "quit"
  47. c.recentField = "input"
  48. c = cli_exit(c)
  49. if (
  50. c.recentField == "exit"
  51. ):
  52. return "OK: cli_exit_quit"
  53. #}
  54. return "ERR: cli_exit_quit"
  55. #}
  56. def cli_test_greetUser(
  57. ) -> str:
  58. c = memory_createContext()
  59. c.didLaunch = True
  60. c.recentField = "didLaunch"
  61. c = cli_greetUser(c)
  62. if (
  63. c.recentField == "outputGreeting"
  64. ):
  65. return "OK: cli_greetUser"
  66. #}
  67. return "ERR: cli_greetUser"
  68. #}
  69. def cli_test_promptSecondItemSelection(
  70. ) -> str:
  71. c = memory_createContext()
  72. c.input = "1"
  73. c.recentField = "input"
  74. c = cli_selectItem(c)
  75. c = memory_selectItem(c)
  76. c = cli_promptSecondItemSelection(c)
  77. if (
  78. c.recentField == "outputPromptSelection"
  79. ):
  80. return "OK: cli_promptSecondItemSelection"
  81. #}
  82. return "ERR: cli_promptSecondItemSelection"
  83. #}
  84. def cli_test_reportMatchedItems(
  85. ) -> str:
  86. c = memory_createContext()
  87. c.playfieldSize = 2
  88. c.recentField = "playfieldSize"
  89. c = memory_generateConstPlayfield(c)
  90. c.input = "1"
  91. c.recentField = "input"
  92. c = cli_selectItem(c)
  93. c = memory_selectItem(c)
  94. c.input = "2"
  95. c.recentField = "input"
  96. c = cli_selectItem(c)
  97. c = memory_selectItem(c)
  98. c = memory_hideMatchingItems(c)
  99. c = cli_reportMatchedItems(c)
  100. if (
  101. c.recentField == "outputMatchedItems"
  102. ):
  103. return "OK: cli_reportMatchedItems"
  104. #}
  105. return "ERR: cli_reportMatchedItems"
  106. #}
  107. def cli_test_selectItem(
  108. ) -> str:
  109. c = memory_createContext()
  110. c.input = "1"
  111. c.recentField = "input"
  112. c = cli_selectItem(c)
  113. if (
  114. c.recentField == "selectedId" and
  115. c.selectedId == 0
  116. ):
  117. return "OK: cli_selectItem"
  118. #}
  119. return "ERR: cli_selectItem"
  120. #}
  121. def cli_test_showHelp_h(
  122. ) -> str:
  123. c = memory_createContext()
  124. c.input = "h"
  125. c.recentField = "input"
  126. c = cli_showHelp(c)
  127. if (
  128. c.recentField == "outputHelp"
  129. ):
  130. return "OK: cli_showHelp_h"
  131. #}
  132. return "ERR: cli_showHelp_h"
  133. #}
  134. def cli_test_showHelp_help(
  135. ) -> str:
  136. c = memory_createContext()
  137. c.input = "help"
  138. c.recentField = "input"
  139. c = cli_showHelp(c)
  140. if (
  141. c.recentField == "outputHelp"
  142. ):
  143. return "OK: cli_showHelp_help"
  144. #}
  145. return "ERR: cli_showHelp_help"
  146. #}
  147. #def cli_test_shouldReportIvalidItemSelection_outOfBoundsMin(
  148. #) -> str:
  149. # c = cli_createContext()
  150. # c.cMemory = memory_createContext()
  151. # c.input = "0"
  152. # c = cli_selectItem(c)
  153. # c = cli_shouldReportInvalidItemSelection(c)
  154. # if (
  155. # c.recentField == "outputInvalidItemSelection"
  156. # ):
  157. # return "OK: cli_shouldReportInvalidItemSelection"
  158. # #}
  159. # return "ERR: cli_shouldReportInvalidItemSelection"
  160. ##}
  161. #