root/lang/python/spaghetti_monster/tests.py @ 31921

Revision 31921, 1.9 kB (checked in by nishio, 6 years ago)

/lang/python/spaghetti_monster separate tests

Line 
1import main
2from main import *
3
4def test_worm():
5    main.inputter = Inputter(buf=[1, 0])
6    cards = [Worm()]
7    players = [Player("nishio", "(N)")]
8    cards[0].bits.append(players[0])
9    g = GameManager(cards, players)
10    g.eval_card()
11    assert len(cards[0].bits) == 2
12
13test_worm()
14
15def test_heal():
16    main.inputter = Inputter(buf=[1, 0])
17    cards = [Heal()]
18    players = [Player("nishio", "(N)")]
19    cards[0].bits.append(players[0])
20    g = GameManager(cards, players)
21    g.eval_card()
22    assert players[0].lifepoint == 11
23
24test_heal()
25
26def test_inc():
27    main.inputter = Inputter(buf=[1, 1, 'y', 1, 0])
28    cards = [Inc(), Heal()]
29    players = [Player("nishio", "(N)")]
30    cards[0].bits.append(players[0])
31    cards[1].bits.append(players[0])
32    g = GameManager(cards, players)
33    g.eval_card()
34    g.progress_pc()
35    g.eval_card()
36    assert players[0].lifepoint == 12
37
38test_inc()
39
40def test_mimic():
41    main.inputter = Inputter(buf=[1, 3, "x", 3, "y", 1, 0, 0])
42    cards = [Mimic(), Inc(), Inc(), Heal()]
43    players = [Player("nishio", "(N)")]
44    cards[0].bits.append(players[0])
45    cards[3].bits.append(players[0])
46    g = GameManager(cards, players)
47    g.eval_card()
48    g.progress_pc()
49    g.eval_card()
50    assert players[0].lifepoint == 14
51
52test_mimic()   
53
54def test_float():
55    main.inputter = Inputter(buf=[1, 1, 1, 2])
56    cards = [Test("A"), Test("B"), Float(), Test("C"), Test("D")]
57    players = [Player("nishio", "(N)")]
58    cards[2].bits.append(players[0])
59    g = GameManager(cards, players)
60    g.eval_card()
61    g.progress_pc()
62    g.eval_card()
63
64test_float()
65
66def test_rm_bit():
67    main.inputter = Inputter(buf=[1, 0, 0])
68    cards = [RemoveBit(), Inc(), Inc()]
69    players = [Player("nishio", "(N)")]
70    cards[0].bits.append(players[0])
71    g = GameManager(cards, players)
72    g.pretty_print()
73    g.eval_card()
74    g.pretty_print()
75
76test_rm_bit()   
Note: See TracBrowser for help on using the browser.