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.

memory_seq_test.py 1.2KB

6 months ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. from memory_api import *
  2. from memory_api_Context import *
  3. from memory_seq import *
  4. from memory_seq_Context import *
  5. def memory_seq_test_selectThreeItems(
  6. ) -> str:
  7. seq = memory_seq_createContext()
  8. seq.api = memory_api_createContext()
  9. seq.api.playfieldSize = 2
  10. seq.api = memory_api_generateConstPlayfield(seq.api)
  11. seq.itemsToSelect = [0, 1, 2]
  12. seq = memory_seq_selectItems(seq)
  13. # See if only one (last) item is selected now.
  14. if (
  15. seq.api.recentField == "selectedItems" and
  16. len(seq.api.selectedItems) == 1 and
  17. seq.api.selectedItems[0] == 2
  18. ):
  19. return "OK: memory_seq_selectThreeItems"
  20. #}
  21. return "ERR: memory_seq_selectThreeItems"
  22. #}
  23. def memory_seq_test_selectTwoItems(
  24. ) -> str:
  25. seq = memory_seq_createContext()
  26. seq.api = memory_api_createContext()
  27. seq.api.playfieldSize = 2
  28. seq.api = memory_api_generateConstPlayfield(seq.api)
  29. seq.itemsToSelect = [0, 1]
  30. seq = memory_seq_selectItems(seq)
  31. # See if both items are selected now.
  32. if (
  33. seq.api.recentField == "selectedItems" and
  34. len(seq.api.selectedItems) == 2 and
  35. seq.api.selectedItems[0] == 0 and
  36. seq.api.selectedItems[1] == 1
  37. ):
  38. return "OK: memory_seq_selectTwoItems"
  39. #}
  40. return "ERR: memory_seq_selectTwoItems"
  41. #}