42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
|
#include <iostream>
|
||
|
#include <cstdlib>
|
||
|
|
||
|
#include "conexion.h"
|
||
|
#include "conexion_ssl.h"
|
||
|
#include "config_reader.h"
|
||
|
#include "tests.h"
|
||
|
|
||
|
#define file_config "config"
|
||
|
CPPUNIT_TEST_SUITE_REGISTRATION( test_basic );
|
||
|
int main()
|
||
|
{
|
||
|
//inicio de los tests
|
||
|
CPPUNIT_NS::TestResult testresult;
|
||
|
CPPUNIT_NS::TestResultCollector collectedresults;
|
||
|
testresult.addListener (&collectedresults);
|
||
|
CPPUNIT_NS::BriefTestProgressListener progress;
|
||
|
testresult.addListener (&progress);
|
||
|
CPPUNIT_NS::TestRunner testrunner;
|
||
|
testrunner.addTest (CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest ());
|
||
|
testrunner.run(testresult);
|
||
|
CPPUNIT_NS::CompilerOutputter compileroutputter(&collectedresults, std::cerr);
|
||
|
compileroutputter.write ();
|
||
|
|
||
|
config_reader conf = config_reader(file_config);
|
||
|
string option;
|
||
|
if(conf.get_param("security",option)){
|
||
|
conexion *con=nullptr;
|
||
|
if(option=="yes"){
|
||
|
con = new conexion_ssl(conf);
|
||
|
}else if(option=="no"){
|
||
|
con = new conexion(conf);
|
||
|
}else{
|
||
|
perror("unknow option in security option");
|
||
|
}
|
||
|
con->start_server();
|
||
|
}else{
|
||
|
perror("no define security option");
|
||
|
}
|
||
|
return 0;
|
||
|
}
|