Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CPP Ecosystem Project
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
Container 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
RIVOAL Samuel
CPP Ecosystem Project
Commits
b590a1db
Commit
b590a1db
authored
4 years ago
by
fuzzy_bunny
Browse files
Options
Downloads
Patches
Plain Diff
added test for PetFactory
parent
7f965643
No related branches found
No related tags found
1 merge request
!19
Master
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
makeTestPetFactory.mk
+41
-0
41 additions, 0 deletions
makeTestPetFactory.mk
tests/testPetFactory.cpp
+46
-0
46 additions, 0 deletions
tests/testPetFactory.cpp
with
87 additions
and
0 deletions
makeTestPetFactory.mk
0 → 100644
+
41
−
0
View file @
b590a1db
SRCDIR
:=
src/
TESTSDIR
:=
tests/
testPetFactory
:
$(TESTSDIR)testPetFactory.cpp Aquarium.o Pet.o Environment.o Animal.o PetFactory.o Fin.o Eyes.o KamikazeBehaviour.o FearfulBehaviour.o GregariousBehaviour.o Statistics.o MoveUtils.o
g++
-Wall
-std
=
c++11
-o
testPetFactory
$(
TESTSDIR
)
testPetFactory.cpp Aquarium.o Pet.o Environment.o Animal.o PetFactory.o Fin.o Eyes.o FearfulBehaviour.o GregariousBehaviour.o Statistics.o KamikazeBehaviour.o MoveUtils.o
-I
$(
SRCDIR
)
-lX11
-lpthread
Aquarium.o
:
src/Aquarium.h src/Aquarium.cpp
g++
-Wall
-std
=
c++11
-c
$(
SRCDIR
)
Aquarium.cpp
-I
$(
SRCDIR
)
Pet.o
:
$(SRCDIR)Pet.h $(SRCDIR)Pet.cpp
g++
-Wall
-std
=
c++11
-c
$(
SRCDIR
)
Pet.cpp
-I
$(
SRCDIR
)
Animal.o
:
$(SRCDIR)Animal.h $(SRCDIR)Animal.cpp
g++
-Wall
-std
=
c++11
-c
$(
SRCDIR
)
Animal.cpp
-I
$(
SRCDIR
)
Environment.o
:
$(SRCDIR)Environment.h $(SRCDIR)Environment.cpp
g++
-Wall
-std
=
c++11
-c
$(
SRCDIR
)
Environment.cpp
-I
$(
SRCDIR
)
PetFactory.o
:
$(SRCDIR)PetFactory.h $(SRCDIR)PetFactory.cpp
g++
-Wall
-std
=
c++11
-c
$(
SRCDIR
)
PetFactory.cpp
-I
$(
SRCDIR
)
Fin.o
:
$(SRCDIR)Fin.h $(SRCDIR)Fin.cpp
g++
-Wall
-std
=
c++11
-c
$(
SRCDIR
)
Fin.cpp
-I
$(
SRCDIR
)
Eyes.o
:
$(SRCDIR)Eyes.h $(SRCDIR)Eyes.cpp
g++
-Wall
-std
=
c++11
-c
$(
SRCDIR
)
Eyes.cpp
-I
$(
SRCDIR
)
GregariousBehaviour.o
:
$(SRCDIR)GregariousBehaviour.h $(SRCDIR)GregariousBehaviour.cpp
g++
-Wall
-std
=
c++11
-c
$(
SRCDIR
)
GregariousBehaviour.cpp
-I
$(
SRCDIR
)
FearfulBehaviour.o
:
$(SRCDIR)FearfulBehaviour.h $(SRCDIR)FearfulBehaviour.cpp
g++
-Wall
-std
=
c++11
-c
$(
SRCDIR
)
FearfulBehaviour.cpp
-I
$(
SRCDIR
)
KamikazeBehaviour.o
:
$(SRCDIR)KamikazeBehaviour.h $(SRCDIR)KamikazeBehaviour.cpp
g++
-Wall
-std
=
c++11
-c
$(
SRCDIR
)
KamikazeBehaviour.cpp
-I
$(
SRCDIR
)
Statistics.o
:
$(SRCDIR)Statistics.h $(SRCDIR)Statistics.cpp
g++
-Wall
-std
=
c++11
-c
$(
SRCDIR
)
Statistics.cpp
-I
$(
SRCDIR
)
MoveUtils.o
:
$(SRCDIR)MoveUtils.h $(SRCDIR)MoveUtils.cpp
g++
-Wall
-std
=
c++11
-c
$(
SRCDIR
)
MoveUtils.cpp
-I
$(
SRCDIR
)
This diff is collapsed.
Click to expand it.
tests/testPetFactory.cpp
0 → 100644
+
46
−
0
View file @
b590a1db
#include
"Aquarium.h"
#include
"Environment.h"
#include
"Pet.h"
#include
"GregariousBehaviour.h"
#include
"FearfulBehaviour.h"
#include
"KamikazeBehaviour.h"
#include
<iostream>
using
namespace
std
;
int
main
(){
int
windowWidth
=
640
;
int
windowHeight
=
480
;
int
delay
=
30
;
int
startingNbPets
=
10
;
map
<
string
,
float
>
animalsDistribution
=
{{
KamikazeBehaviour
::
getBehaviourInstance
()
->
getBehaviourName
(),
100
}};
map
<
string
,
float
>
animalsDistribution2
=
{{
KamikazeBehaviour
::
getBehaviourInstance
()
->
getBehaviourName
(),
50
},
{
FearfulBehaviour
::
getBehaviourInstance
()
->
getBehaviourName
(),
50
}};
map
<
string
,
float
>
animalsDistribution3
=
{{
KamikazeBehaviour
::
getBehaviourInstance
()
->
getBehaviourName
(),
30
},
{
FearfulBehaviour
::
getBehaviourInstance
()
->
getBehaviourName
(),
30
},
{
GregariousBehaviour
::
getBehaviourInstance
()
->
getBehaviourName
(),
20
},
{
"multiple"
,
20
}};
Aquarium
*
ecosystem
=
new
Aquarium
(
windowWidth
,
windowHeight
,
delay
,
startingNbPets
,
animalsDistribution
);
ecosystem
->
run
();
//usleep(5*pow(10,6));
//ecosystem.close();
delete
ecosystem
;
Aquarium
*
ecosystem2
=
new
Aquarium
(
windowWidth
,
windowHeight
,
delay
,
startingNbPets
,
animalsDistribution2
);
ecosystem2
->
run
();
//usleep(5*pow(10,6));
//ecosystem2.close();
delete
ecosystem2
;
Aquarium
*
ecosystem3
=
new
Aquarium
(
windowWidth
,
windowHeight
,
delay
,
startingNbPets
,
animalsDistribution3
);
ecosystem3
->
run
();
//usleep(5*pow(10,6));
//ecosystem3.close();
delete
ecosystem3
;
return
0
;}
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