-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcard_test.py
44 lines (36 loc) · 1.38 KB
/
card_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from game import Game
from game_library import *
from name_registry import reset_name_registry
import time
from typing import List
from card import ALL_CARDS
SEC = "#" + "="*79 + "\n"
tests_to_run = {"unit_tests", "landslide+flipped"}
def test_cards(card_names:List[str], n_moves=12) -> None:
reset_name_registry()
G = Game(TEST_GAME_CONFIG)
G.render()
commands = [f"ds {card_name}" for card_name in card_names]
G.execute_commands(commands, display=True)
# play a nonsense game
G.execute_commands([f"n {n_moves}"], display=False)
G.render()
#===============================================================================
# Unit tests
if "unit_tests" in tests_to_run:
for card_name in ALL_CARDS:
print(f"{SEC}Test {card_name}")
test_cards([card_name])
#===============================================================================
# Bunit tests
if "unit_tests" in tests_to_run:
for card_name_a in ALL_CARDS:
for card_name_b in ALL_CARDS:
if card_name_a == card_name_b: continue # rip this is bc the name registry
print(f"{SEC}Test {card_name_a} + {card_name_b}")
test_cards([card_name_a, card_name_b], n_moves=6)
#===============================================================================
# integration tests
if "landslide+flipped" in tests_to_run:
print(f"{SEC}Test Landslide + Flipped Classroom")
test_cards(["Landslide", "FlippedClassroom"])