forked from marqueswill/trabalho2-TP1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrivers.cpp
More file actions
216 lines (187 loc) · 6.59 KB
/
drivers.cpp
File metadata and controls
216 lines (187 loc) · 6.59 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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#include "drivers.h"
//----------------------------------------------------------------------------------------------------------------------
void Drivers::showResult(bool resultado, string nome, int l) {
string texto1 = "SUCESSO";
string texto2 = "FALHA";
int linha, coluna;
getmaxyx(stdscr, linha, coluna);
int linha_atual = linha / 4 + l;
texto1 = nome + string(16 - nome.length(), '.') + texto1;
texto2 = nome + string(16 - nome.length(), '.') + texto2;
if (resultado) {
mvprintw(linha_atual, coluna / 4, "%s", texto1.c_str());
} else {
mvprintw(linha_atual, coluna / 4, "%s", texto2.c_str());
}
}
//----------------------------------------------------------------------------------------------------------------------
void DriverDepuracao::executar() {
DriverTestesUnitarios testesUnitarios;
DriverTestesIntegracao testesIntegracao;
int campo;
bool apresentar = true;
while (apresentar) {
TelaDepuracao telaDepuracao;
telaDepuracao.selecionar(&campo);
switch (campo) {
case TESTE_UNITARIO:
testesUnitarios.executar();
break;
case TESTE_INTEGRACAO:
testesIntegracao.executar();
break;
case TESTE_FUMACA:
break;
case TESTE_SISTEMA:
break;
case SAIR:
apresentar = false;
break;
default:
TelaMensagem telaMensagem;
telaMensagem.apresentar("Opção inválida. Pressione qualquer tecla para continuar.");
break;
}
}
}
//----------------------------------------------------------------------------------------------------------------------
void DriverTestesUnitarios::executar() {
DriverTestesDominios testesDominios;
DriverTestesEntidades testesEntidades;
DriverTestesModulos testesModulos;
int campo;
bool apresentar = true;
while (apresentar) {
TelaTestesUnitarios telaTestesUnitarios;
telaTestesUnitarios.selecionar(&campo);
switch (campo) {
case DOMINIOS:
testesDominios.executar();
break;
case ENTIDADES:
testesEntidades.executar();
break;
case MODULOS:
testesModulos.executar();
break;
case RETORNAR:
apresentar = false;
break;
default:
TelaMensagem telaMensagem;
telaMensagem.apresentar("Opção inválida. Pressione qualquer tecla para continuar.");
break;
}
}
}
//----------------------------------------------------------------------------------------------------------------------
void DriverTestesDominios::executar() {
int linha, coluna;
string title = "DOMINIOS";
initscr();
getmaxyx(stdscr, linha, coluna);
clear();
mvprintw(linha / 4 + 0, coluna / 4, "%s", title.c_str());
showResult(testeClasse.run(), "Classe", 1);
showResult(testeCodigo.run(), "Codigo", 2);
showResult(testeData.run(), "Data", 3);
showResult(testeMatricula.run(), "Matricula", 4);
showResult(testeResultado.run(), "Resultado", 5);
showResult(testeSenha.run(), "Senha", 6);
showResult(testeTelefone.run(), "Telefone", 7);
showResult(testeTexto.run(), "Texto", 8);
mvprintw(linha / 4 + 9, coluna / 4, "%s", "");
echo();
getch();
noecho();
endwin();
}
//----------------------------------------------------------------------------------------------------------------------
void DriverTestesEntidades::executar() {
int linha, coluna;
string title = "ENTIDADES";
initscr();
getmaxyx(stdscr, linha, coluna);
clear();
mvprintw(linha / 4 + 0, coluna / 4, "%s", title.c_str());
showResult(testeDesenvolvedor.run(), "Desenvolvedor", 1);
showResult(testeTeste.run(), "Teste", 2);
showResult(testeCasoDeTeste.run(), "CasoDeTeste", 3);
mvprintw(linha / 4 + 4, coluna / 4, "%s", "");
echo();
getch();
noecho();
endwin();
}
//----------------------------------------------------------------------------------------------------------------------
void DriverTestesModulos::executar() {
TUIAAutenticacao testeAutenticacao;
TUIADesenvolvedor testeDesenvolvedor;
TUIATeste testeTeste;
TUIACasoDeTeste testeCasoDeTeste;
int campo;
bool apresentar = true;
while (apresentar) {
TelaTestesModulos telaTestesModulos;
telaTestesModulos.selecionar(&campo);
switch (campo) {
case AUTENTICACAO:
testeAutenticacao.executar();
break;
case DESENVOLVEDOR:
testeDesenvolvedor.executar();
break;
case TESTE:
testeTeste.executar();
break;
case CASODETESTE:
testeCasoDeTeste.executar();
break;
case RETORNAR:
apresentar = false;
break;
default:
TelaMensagem telaMensagem;
telaMensagem.apresentar("Opção inválida. Pressione qualquer tecla para continuar.");
break;
}
}
}
//----------------------------------------------------------------------------------------------------------------------
void DriverTestesIntegracao::executar() {
TIApresentacao testeApresentacao;
TIAutenticacao testeAutenticacao;
TIDesenvolvedor testeDesenvolvedor;
TITeste testeTeste;
TICasoDeTeste testeCasoDeTeste;
int campo;
bool apresentar = true;
while (apresentar) {
TelaTestesIntegracao telaTestesIntegracao;
telaTestesIntegracao.selecionar(&campo);
switch (campo) {
case CAMADA_APRESENTACAO:
testeApresentacao.executar();
break;
case SUBSISTEMA_AUTENTICACAO:
testeAutenticacao.executar();
break;
case SUBSISTEMA_DESENVOLVEDOR:
testeDesenvolvedor.executar();
break;
case SUBSISTEMA_TESTE:
testeTeste.executar();
break;
case SUBSISTEMA_CASODETESTE:
testeCasoDeTeste.executar();
break;
case RETORNAR:
apresentar = false;
break;
default:
TelaMensagem telaMensagem;
telaMensagem.apresentar("Opção inválida. Pressione qualquer tecla para continuar.");
break;
}
}
}