-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
87 lines (67 loc) · 1.55 KB
/
main.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# coding=utf8
import unittest
import random
import re
def existeNaLista(item,lista):
list.index
def testarNumeros(assassino,local,arma):
retorno= []
if (assassino != 5):
retorno.append(1)
if (local != 3):
retorno.append(2)
if (arma != 4):
retorno.append(3)
if len(retorno) > 0:
return retorno[random.randrange(0, len(retorno))]
else:
return 0
############# teste ###############
class QuemMatouBillGTeste(unittest.TestCase):
def teste1(self):
self.assertEqual(0, testarNumeros(5,3,4))
def teste2(self):
self.assertRegex(str(testarNumeros(1,2,3)),"[123]")
def testeParametro1Errado(self):
self.assertEqual(1, testarNumeros(1,3,4))
def testeParametro2Errado(self):
self.assertEqual(2, testarNumeros(5,1,4))
def testeParametro3Errado(self):
self.assertEqual(3, testarNumeros(5,3,1))
def teste2Erros(self):
self.assertRegex(str(testarNumeros(5,4,1)), "[23]")
#1,1,1 : 2
#1,2,1 : 2
#1,3,1 : 1
#2,3,1 : 3
#2,3,2 : 3
#2,3,3 : 3
#2,3,4 : 0
#5,3,4
if __name__ == '__main__':
unittest.main()
'''Suspeitos:
Charles B. Abbage
Donald Duck Knuth
Ada L. Ovelace
Alan T. Uring
Ivar J. Acobson
Ras Mus Ler Dorf
Locais:
Redmond
Palo Alto
San Francisco
Tokio
Restaurante no Fim do Universo
São Paulo
Cupertino
Helsinki
Maida Vale
Toronto
Armas:
Peixeira
DynaTAC 8000X (o primeiro aparelho celular do mundo)
Trezoitão
Trebuchet
Maça
Gládio'''