sh8s_deployer/test/ServicesTest/main.cpp

46 lines
1.2 KiB
C++

//test file for class Services
#include "Services.h"
int main()
{
Services aServices = Services("testSample.csv");
vector <Service> result = aServices.getServices();
vector <Service> expectedResult;
list <string> s1={"server1","server1bis"};
list <string> s3={"server3"};
list <string> s4;
list <string> s5;
list <string> s6;
list <string> s7;
list <string> s8={"server8","server8bis","server8ter"};
string emptyUsername;
expectedResult.push_back(Service(1,"username1",s1));
expectedResult.push_back(Service(3,"username3",s3));
expectedResult.push_back(Service(4,"username4",s4));
expectedResult.push_back(Service(5,"username5",s5));
expectedResult.push_back(Service(6,emptyUsername,s6));
expectedResult.push_back(Service(7,"username7",s7));
expectedResult.push_back(Service(8,"username8",s8));
if(expectedResult[4]==result[4]){
cout << "first good" << endl;
}else{
cout << "not good" << endl;
}
if(expectedResult==result){
cout << "Services test: OK" << endl;
return 0;
}else {
cout << "Services test: FAIL" << endl;
return 1;
}
}