-
Notifications
You must be signed in to change notification settings - Fork 0
/
testing-wrapper.py
49 lines (36 loc) · 1.66 KB
/
testing-wrapper.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
45
46
47
48
49
import unittest
from seed import Seed, Gen
from wrapper import parseInput, seedbank, reload
class Testing(unittest.TestCase):
def setUp(self) -> None:
reload()
def test_clean(self):
parseInput("r 0")
self.assertEqual(parseInput("c"), "Erfolgreich")
self.assertEqual(len(seedbank.seedbank), 2)
self.assertEqual(seedbank.retrieve(1), Seed([Gen(['a', 'a'])], researched=True))
def test_help(self):
self.assertEqual(parseInput('h'), "clean, exit, help, list, mate, research")
def test_list(self):
self.assertEqual(parseInput('l'), seedbank)
def test_research(self):
self.assertEqual(parseInput("r 0"), "Erfolgreich")
self.assertEqual(parseInput("r 1"), "Erfolgreich")
self.assertEqual(seedbank.retrieve(2), Seed([Gen(['a', 'a'])], researched=True))
self.assertEqual(seedbank.retrieve(3), Seed([Gen(['A', 'A'])], researched=True))
def test_research_all(self):
self.assertEqual(parseInput("ra"), "Erfolgreich")
self.assertEqual(seedbank.retrieve(2), Seed([Gen(['a', 'a'])], researched=True))
self.assertEqual(seedbank.retrieve(3), Seed([Gen(['A', 'A'])], researched=True))
def test_mate(self):
parseInput("r 0")
parseInput("r 1")
self.assertEqual(parseInput("m 2 3"), "Erfolgreich")
self.assertEqual(seedbank.sum(), 4)
self.assertEqual(seedbank.retrieve(4), Seed([Gen(['A', 'a'])]))
def test_nichts(self):
self.assertEqual(parseInput(" "), "Nichts")
def test_valider_input(self):
self.assertEqual(parseInput("r e"), "Fehlerhafte Eingabe")
if __name__ == "__main__":
unittest.main()