-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_kingmaker.py
More file actions
57 lines (45 loc) · 1.43 KB
/
test_kingmaker.py
File metadata and controls
57 lines (45 loc) · 1.43 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
'''
Created on Feb 11, 2014
@author: rwill127
'''
from nose.tools import *
import kingmaker as k
class TestNode(object):
def setup(self):
self.n = k.Node(1, 1)
def test_node_init(self):
eq_(self.n.occupied, False)
class TestGrid(object):
def setup(self):
self.g = k.Grid()
def test_grid_init(self):
eq_(len(self.g.nodes), 8)
eq_(len(self.g.nodes[0]), 8)
ok_(isinstance(self.g.nodes[0][0], k.Node))
def test_get_node(self):
n = self.g.get_node(3, 4)
eq_(n.x, 3)
eq_(n.y, 4)
class TestChar(object):
def setup(self):
self.c = k.Character()
self.nigel_profile = {"Name": "Nigel",
"STR": 16,
"DEX": 13,
"CON": 17,
"INT": 15,
"WIS": 20,
"CHA": 14
}
def test_get_mod(self):
self.c.strength = 18
str_mod = self.c.get_mod(self.c.strength)
eq_(str_mod, 4)
self.c.wisdom = 9
wis_mod = self.c.get_mod(self.c.wisdom)
eq_(wis_mod, -1)
def test_setup(self):
self.c.setup(self.nigel_profile)
ok_(self.c.name == "Nigel")
ok_(self.c.wisdom == 20)
ok_(self.c.get_mod(self.c.wisdom)==5)