-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtestrunner.py
68 lines (64 loc) · 2.49 KB
/
testrunner.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import pytest
import unittest
from MASTR002 import setGuessflags
class TestRunner(unittest.TestCase):
def test_setGuessflagsRed(self):
chances = 8
passcode = []
passcode.append(1)
passcode.append(6)
passcode.append(2)
passcode.append(5)
turn=1
guess_flags = [['-', '-', '-', '-'] for x in range(chances)]
guess_codes = [['1', '6', '2', '5'] for x in range(chances)]
newguessflags = setGuessflags(guess_flags,turn,guess_codes,passcode)
self.assertEqual(['R', 'R', 'R', 'R'], newguessflags[1])
def test_setGuessflagsRedWhite(self):
chances = 8
passcode = []
passcode.append(1)
passcode.append(6)
passcode.append(2)
passcode.append(5)
turn=1
guess_flags = [['-', '-', '-', '-'] for x in range(chances)]
guess_codes = [['1', '6', '5', '2'] for x in range(chances)]
newguessflags = setGuessflags(guess_flags,turn,guess_codes,passcode)
self.assertEqual(['R', 'R', 'W', 'W'], newguessflags[1])
def test_setGuessflagsNone(self):
chances = 8
passcode = []
passcode.append(1)
passcode.append(6)
passcode.append(2)
passcode.append(5)
turn=1
guess_flags = [['-', '-', '-', '-'] for x in range(chances)]
guess_codes = [['2', '2', '3', '3'] for x in range(chances)]
newguessflags = setGuessflags(guess_flags,turn,guess_codes,passcode)
self.assertEqual(['W', '-', '-', '-'], newguessflags[1])
def test_setGuessflagsSimulation2262(self):
chances = 8
passcode = []
passcode.append(2)
passcode.append(2)
passcode.append(6)
passcode.append(2)
turn=1
guess_flags = [['-', '-', '-', '-'] for x in range(chances)]
guess_codes = [['1', '1', '2', '2'] for x in range(chances)]
newguessflags = setGuessflags(guess_flags,turn,guess_codes,passcode)
self.assertEqual(['-', '-', 'W', 'W'], newguessflags[1])
def test_setGuessflagsSimulation4464(self):
chances = 8
passcode = []
passcode.append(4)
passcode.append(4)
passcode.append(6)
passcode.append(4)
turn = 1
guess_flags = [['-', '-', '-', '-'] for x in range(chances)]
guess_codes = [['4', '4', '4', '4'] for x in range(chances)]
newguessflags = setGuessflags(guess_flags, turn, guess_codes, passcode)
self.assertEqual(['R', 'R', '-', 'R'], newguessflags[1])