Skip to content
Snippets Groups Projects
Commit b590a1db authored by fuzzy_bunny's avatar fuzzy_bunny
Browse files

added test for PetFactory

parent 7f965643
No related branches found
No related tags found
1 merge request!19Master
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)
#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;}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment