13 #define BOOST_TEST_DYN_LINK
14 #define BOOST_TEST_MAIN
15 #define BOOST_TEST_MODULE FQTTestSuite
16 #include <boost/test/unit_test.hpp>
18 #include <stdair/basic/BasLogParams.hpp>
19 #include <stdair/basic/BasDBParams.hpp>
20 #include <stdair/basic/BasFileMgr.hpp>
21 #include <stdair/service/Logger.hpp>
22 #include <stdair/bom/TravelSolutionStruct.hpp>
23 #include <stdair/bom/BookingRequestStruct.hpp>
26 #include <simfqt/config/simfqt-paths.hpp>
28 namespace boost_utf = boost::unit_test;
33 struct UnitTestConfig {
36 static std::ofstream _test_log (
"FQTTestSuite_utfresults.xml");
37 boost_utf::unit_test_log.set_stream (_test_log);
38 boost_utf::unit_test_log.set_format (boost_utf::XML);
39 boost_utf::unit_test_log.set_threshold_level (boost_utf::log_test_units);
52 void testFareQuoterHelper (
const unsigned short iTestFlag,
53 const stdair::Filename_T iFareInputFilename,
54 const bool isBuiltin) {
57 std::ostringstream oStr;
58 oStr <<
"FQTTestSuite_" << iTestFlag <<
".log";
59 const stdair::Filename_T lLogFilename (oStr.str());
62 std::ofstream logOutputFile;
64 logOutputFile.open (lLogFilename.c_str());
65 logOutputFile.clear();
68 const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG,
75 if (isBuiltin ==
true) {
78 simfqtService.buildSampleBom();
84 simfqtService.parseAndLoad (lFareFilePath);
88 stdair::TravelSolutionList_T lTravelSolutionList;
89 simfqtService.buildSampleTravelSolutions (lTravelSolutionList);
90 stdair::BookingRequestStruct lBookingRequest =
91 simfqtService.buildBookingRequest();
94 simfqtService.quotePrices (lBookingRequest, lTravelSolutionList);
97 logOutputFile.close();
104 BOOST_GLOBAL_FIXTURE (UnitTestConfig);
107 BOOST_AUTO_TEST_SUITE (master_test_suite)
112 BOOST_AUTO_TEST_CASE (simfqt_simple_pricing_test) {
115 const stdair::Filename_T lFareInputFilename (STDAIR_SAMPLE_DIR
"/fare01.csv");
118 const bool isBuiltin =
false;
121 BOOST_CHECK_NO_THROW (testFareQuoterHelper (0, lFareInputFilename, isBuiltin));
129 BOOST_AUTO_TEST_CASE (simfqt_error_pricing_test_01) {
132 const stdair::Filename_T lFareInputFilename (STDAIR_SAMPLE_DIR
"/fareError01.csv");
135 const bool isBuiltin =
false;
138 BOOST_CHECK_THROW (testFareQuoterHelper (1, lFareInputFilename, isBuiltin),
146 BOOST_AUTO_TEST_CASE (simfqt_error_pricing_test_02) {
149 const stdair::Filename_T lFareInputFilename (STDAIR_SAMPLE_DIR
"/fareError02.csv");
152 const bool isBuiltin =
false;
155 BOOST_CHECK_THROW (testFareQuoterHelper (2, lFareInputFilename, isBuiltin),
163 BOOST_AUTO_TEST_CASE (simfqt_error_pricing_test_03) {
166 const stdair::Filename_T lFareInputFilename (STDAIR_SAMPLE_DIR
"/fareError03.csv");
169 const bool isBuiltin =
false;
172 BOOST_CHECK_THROW (testFareQuoterHelper (3, lFareInputFilename, isBuiltin),
180 BOOST_AUTO_TEST_CASE (simfqt_error_pricing_test_04) {
183 const stdair::Filename_T lFareInputFilename (STDAIR_SAMPLE_DIR
"/fareError04.csv");
186 const bool isBuiltin =
false;
189 BOOST_CHECK_THROW (testFareQuoterHelper (4, lFareInputFilename, isBuiltin),
197 BOOST_AUTO_TEST_CASE (simfqt_error_pricing_test_05) {
200 const stdair::Filename_T lFareInputFilename (STDAIR_SAMPLE_DIR
"/fareError05.csv");
203 const bool isBuiltin =
false;
206 BOOST_CHECK_THROW (testFareQuoterHelper (5, lFareInputFilename, isBuiltin),
214 BOOST_AUTO_TEST_CASE (simfqt_error_pricing_test_06) {
217 const stdair::Filename_T lFareInputFilename (STDAIR_SAMPLE_DIR
"/fareError06.csv");
220 const bool isBuiltin =
false;
223 BOOST_CHECK_THROW (testFareQuoterHelper (6, lFareInputFilename, isBuiltin),
231 BOOST_AUTO_TEST_CASE (simfqt_error_pricing_test_07) {
234 const stdair::Filename_T lFareInputFilename (STDAIR_SAMPLE_DIR
"/fareError07.csv");
237 const bool isBuiltin =
false;
240 BOOST_CHECK_THROW (testFareQuoterHelper (7, lFareInputFilename, isBuiltin),
248 BOOST_AUTO_TEST_CASE (simfqt_error_pricing_test_08) {
251 const stdair::Filename_T lFareInputFilename (STDAIR_SAMPLE_DIR
"/missingFile.csv");
254 const bool isBuiltin =
false;
257 BOOST_CHECK_THROW (testFareQuoterHelper (8, lFareInputFilename, isBuiltin),
265 BOOST_AUTO_TEST_CASE (simfqt_error_pricing_test_09) {
268 const stdair::Filename_T lEmptyInputFilename (STDAIR_SAMPLE_DIR
"/ ");
271 const bool isBuiltin =
true;
274 BOOST_CHECK_NO_THROW(testFareQuoterHelper (9, lEmptyInputFilename, isBuiltin));
279 BOOST_AUTO_TEST_SUITE_END()