Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Design-Biblioteca
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nico Ramos
Design-Biblioteca
Commits
f6acc3b0
Commit
f6acc3b0
authored
6 months ago
by
Nico
Browse files
Options
Downloads
Patches
Plain Diff
Adiciona testes para os usuarios
parent
51131c1e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
sources/ControladorUsuarios.cpp
+1
-1
1 addition, 1 deletion
sources/ControladorUsuarios.cpp
sources/Usuario.cpp
+1
-2
1 addition, 2 deletions
sources/Usuario.cpp
tdd/Makefile
+6
-2
6 additions, 2 deletions
tdd/Makefile
tdd/biblioteca-test.cpp
+25
-6
25 additions, 6 deletions
tdd/biblioteca-test.cpp
with
33 additions
and
11 deletions
sources/ControladorUsuarios.cpp
+
1
−
1
View file @
f6acc3b0
...
@@ -90,7 +90,7 @@ int ControladorUsuarios::recuperarMultas(string CPF){
...
@@ -90,7 +90,7 @@ int ControladorUsuarios::recuperarMultas(string CPF){
if
(
it
==
usuarios
.
end
())
{
if
(
it
==
usuarios
.
end
())
{
cerr
<<
"> Erro: Usuario não encontrado"
<<
endl
;
cerr
<<
"> Erro: Usuario não encontrado"
<<
endl
;
return
-
1
;
return
0
;
}
}
return
it
->
getMulta
();
return
it
->
getMulta
();
...
...
This diff is collapsed.
Click to expand it.
sources/Usuario.cpp
+
1
−
2
View file @
f6acc3b0
...
@@ -10,8 +10,7 @@ using namespace std;
...
@@ -10,8 +10,7 @@ using namespace std;
// Construtor
// Construtor
Usuario
::
Usuario
(
const
string
&
nome
,
const
string
&
cpf
,
const
string
&
end
,
Usuario
::
Usuario
(
const
string
&
nome
,
const
string
&
cpf
,
const
string
&
end
,
const
string
&
tel
,
const
string
&
email
)
const
string
&
tel
,
const
string
&
email
)
:
nome
(
nome
),
CPF
(
cpf
),
endereco
(
end
),
telefone
(
tel
),
email
(
email
)
{
:
nome
(
nome
),
CPF
(
cpf
),
endereco
(
end
),
telefone
(
tel
),
email
(
email
),
multas
(
0
)
{
this
->
multas
=
10
;
}
}
void
Usuario
::
mostrarDetalhes
()
const
{
void
Usuario
::
mostrarDetalhes
()
const
{
...
...
This diff is collapsed.
Click to expand it.
tdd/Makefile
+
6
−
2
View file @
f6acc3b0
...
@@ -2,12 +2,16 @@
...
@@ -2,12 +2,16 @@
CXX
=
g++
CXX
=
g++
CXXFLAGS
=
-I
../sources
CXXFLAGS
=
-I
../sources
LDFLAGS
=
-lm
LDFLAGS
=
-lm
SRCS
=
main.cpp
obras
-test.cpp
\
SRCS
=
main.cpp
biblioteca
-test.cpp
\
../sources/ControladorObras.cpp
\
../sources/ControladorObras.cpp
\
../sources/Usuario.cpp
\
../sources/Emprestimo.cpp
\
../sources/ControladorUsuarios.cpp
\
../sources/Periodico.cpp
\
../sources/Periodico.cpp
\
../sources/Livro.cpp
\
../sources/Livro.cpp
\
../sources/DescricaoObra.cpp
\
../sources/DescricaoObra.cpp
\
../sources/Obra.cpp
../sources/Obra.cpp
\
../sources/Biblioteca.cpp
OBJ
=
$(
SRCS:.cpp
=
.o
)
OBJ
=
$(
SRCS:.cpp
=
.o
)
TARGET
=
main
TARGET
=
main
...
...
This diff is collapsed.
Click to expand it.
tdd/biblioteca-test.cpp
+
25
−
6
View file @
f6acc3b0
...
@@ -2,20 +2,39 @@
...
@@ -2,20 +2,39 @@
#include
<tuple>
#include
<tuple>
#include
"doctest.h"
#include
"doctest.h"
#include
"../sources/ControladorObras.hpp"
#include
"../sources/ControladorObras.hpp"
#include
"../sources/ControladorUsuarios.hpp"
#include
"../sources/Biblioteca.hpp"
#include
"../sources/Livro.hpp"
#include
"../sources/Livro.hpp"
#include
"../sources/Periodico.hpp"
#include
"../sources/Periodico.hpp"
TEST_CASE
(
"Biblioteca"
)
{
TEST_CASE
(
"Biblioteca"
)
{
cout
<<
"=> Instanciando Biblioteca"
<<
endl
;
Biblioteca
bib
;
cout
<<
"==> Instanciando o Controlador de Obras"
<<
endl
;
ControladorObras
contObras
=
bib
.
getContObras
();
cout
<<
"==> Instanciando o Controlador de Usuarios"
<<
endl
;
ControladorUsuarios
contUsuarios
=
bib
.
getContUsuarios
();
cout
<<
"=================> Adicionar Usuario <================"
<<
endl
;
cout
<<
"=================> Adicionar Usuario <================"
<<
endl
;
//usuario nao existe
cout
<<
"=> Criando Usuarios"
<<
endl
;
//usuario ja existe
contUsuarios
.
adicionarUsuario
(
"Muriki"
,
"12345"
,
"Casa"
,
"9999"
,
"murikigy@gmail.com"
);
contUsuarios
.
adicionarUsuario
(
"Nico"
,
"54321"
,
"Apartamento"
,
"8888"
,
"nico@gmail.com"
);
contUsuarios
.
mostrarDetalhes
();
CHECK
(
0
==
contUsuarios
.
recuperarMultas
(
"12345"
));
CHECK
(
0
==
contUsuarios
.
recuperarMultas
(
"54321"
));
cout
<<
"=> Cria um usuarios que já existe"
<<
endl
;
contUsuarios
.
adicionarUsuario
(
"Marcus"
,
"12345"
,
"Casa"
,
"9988"
,
"marcus@gmail.com"
);
CHECK
(
0
==
contUsuarios
.
recuperarMultas
(
"12345"
));
contUsuarios
.
mostrarDetalhes
();
cout
<<
"======================================================"
<<
endl
;
cout
<<
"======================================================"
<<
endl
;
cout
<<
"==================> Adicionar Obras <=================="
<<
endl
;
cout
<<
"==================> Adicionar Obras <=================="
<<
endl
;
cout
<<
"> Instanciando o Controlador de Obras"
<<
endl
;
cout
<<
"=> Instanciando um Periodico: "
<<
endl
;
ControladorObras
contObras
;
cout
<<
"==> Instanciando um Periodico: "
<<
endl
;
Periodico
p
(
"Revista de Ciência"
,
2023
,
5
,
3
);
Periodico
p
(
"Revista de Ciência"
,
2023
,
5
,
3
);
p
.
mostrarDetalhes
();
p
.
mostrarDetalhes
();
cout
<<
endl
;
cout
<<
endl
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment