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.

cli_test.py 1.7KB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. from cli import *
  2. from cli_Context import *
  3. from memory import *
  4. from memory_Context import *
  5. def cli_test_greetUser(
  6. ) -> str:
  7. c = cli_createContext()
  8. c = cli_greetUser(c)
  9. if (
  10. c.recentField == "outputGreeting"
  11. ):
  12. return "OK: cli_greetUser"
  13. #}
  14. return "ERR: cli_greetUser"
  15. #}
  16. def cli_test_selectItem(
  17. ) -> str:
  18. c = cli_createContext()
  19. c.cMemory = memory_createContext()
  20. c.input = "1"
  21. c = cli_selectItem(c)
  22. if (
  23. c.recentField == "cMemory" and
  24. c.cMemory.recentField == "selectedItems"
  25. ):
  26. return "OK: cli_selectItem"
  27. #}
  28. return "ERR: cli_selectItem"
  29. #}
  30. def cli_test_shouldPromptSelection(
  31. ) -> str:
  32. c = cli_createContext()
  33. c.cMemory = memory_createContext()
  34. c.input = "1"
  35. c = cli_selectItem(c)
  36. c = cli_shouldPromptSelection(c)
  37. if (
  38. c.recentField == "outputPromptSelection"
  39. ):
  40. return "OK: cli_shouldPromptSelection"
  41. #}
  42. return "ERR: cli_shouldPromptSelection"
  43. #}
  44. def cli_test_shouldReportIvalidItemSelection_outOfBoundsMin(
  45. ) -> str:
  46. c = cli_createContext()
  47. c.cMemory = memory_createContext()
  48. c.input = "0"
  49. c = cli_selectItem(c)
  50. c = cli_shouldReportInvalidItemSelection(c)
  51. if (
  52. c.recentField == "outputInvalidItemSelection"
  53. ):
  54. return "OK: cli_shouldReportInvalidItemSelection"
  55. #}
  56. return "ERR: cli_shouldReportInvalidItemSelection"
  57. #}
  58. def cli_test_showHelp_h(
  59. ) -> str:
  60. c = cli_createContext()
  61. c.input = "h"
  62. c = cli_showHelp(c)
  63. if (
  64. c.recentField == "outputHelp"
  65. ):
  66. return "OK: cli_showHelp_h"
  67. #}
  68. return "ERR: cli_showHelp_h"
  69. #}
  70. def cli_test_showHelp_help(
  71. ) -> str:
  72. c = cli_createContext()
  73. c.input = "help"
  74. c = cli_showHelp(c)
  75. if (
  76. c.recentField == "outputHelp"
  77. ):
  78. return "OK: cli_showHelp_help"
  79. #}
  80. return "ERR: cli_showHelp_help"
  81. #}