13 #define BOOST_TEST_DYN_LINK
14 #define BOOST_TEST_MAIN
15 #define BOOST_TEST_MODULE TravelCCMTest
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/bom/TravelSolutionStruct.hpp>
22 #include <stdair/bom/BookingRequestStruct.hpp>
23 #include <stdair/service/Logger.hpp>
28 namespace boost_utf = boost::unit_test;
31 std::ofstream utfReportStream (
"TravelChoiceTestSuite_utfresults.xml");
36 struct UnitTestConfig {
39 boost_utf::unit_test_log.set_stream (utfReportStream);
40 boost_utf::unit_test_log.set_format (boost_utf::XML);
41 boost_utf::unit_test_log.set_threshold_level (boost_utf::log_test_units);
53 BOOST_GLOBAL_FIXTURE (UnitTestConfig);
56 BOOST_AUTO_TEST_SUITE (master_test_suite)
61 BOOST_AUTO_TEST_CASE (simple_simulation_test) {
76 const stdair::Filename_T lLogFilename (
"TravelChoiceTestSuite.log");
79 std::ofstream logOutputFile;
81 logOutputFile.open (lLogFilename.c_str());
82 logOutputFile.clear();
85 const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
91 STDAIR_LOG_DEBUG (
"Welcome to TravelCCM");
94 const stdair::BookingRequestStruct& lBookingRequest =
95 travelccmService.buildSampleBookingRequest();
98 STDAIR_LOG_DEBUG (
"Booking request: " << lBookingRequest.display());
101 stdair::TravelSolutionList_T lTSList;
102 travelccmService.buildSampleTravelSolutions (lTSList);
105 const std::string& lCSVDump = travelccmService.csvDisplay (lTSList);
106 STDAIR_LOG_DEBUG (lCSVDump);
109 const stdair::TravelSolutionStruct* lTS_ptr =
110 travelccmService.chooseTravelSolution (lTSList, lBookingRequest);
113 BOOST_REQUIRE_MESSAGE (lTS_ptr != NULL,
114 "No travel solution can be found for "
115 << lBookingRequest.display()
116 <<
" within the following list of travel solutions. "
120 logOutputFile.close();
124 BOOST_AUTO_TEST_SUITE_END()