Go to the documentation of this file.00001
00005
00006
00007
00008
00009 #include <sstream>
00010 #include <fstream>
00011 #include <string>
00012
00013 #define BOOST_TEST_DYN_LINK
00014 #define BOOST_TEST_MAIN
00015 #define BOOST_TEST_MODULE YieldTestSuite
00016 #include <boost/test/unit_test.hpp>
00017
00018 #include <stdair/basic/BasLogParams.hpp>
00019 #include <stdair/basic/BasDBParams.hpp>
00020 #include <stdair/basic/BasFileMgr.hpp>
00021 #include <stdair/bom/TravelSolutionStruct.hpp>
00022 #include <stdair/service/Logger.hpp>
00023
00024 #include <airrac/AIRRAC_Service.hpp>
00025 #include <airrac/config/airrac-paths.hpp>
00026
00027 namespace boost_utf = boost::unit_test;
00028
00029
00030 std::ofstream utfReportStream ("YieldTestSuite_utfresults.xml");
00031
00035 struct UnitTestConfig {
00037 UnitTestConfig() {
00038 boost_utf::unit_test_log.set_stream (utfReportStream);
00039 boost_utf::unit_test_log.set_format (boost_utf::XML);
00040 boost_utf::unit_test_log.set_threshold_level (boost_utf::log_test_units);
00041
00042 }
00043
00045 ~UnitTestConfig() {
00046 }
00047 };
00048
00049
00050
00051
00052
00053 BOOST_GLOBAL_FIXTURE (UnitTestConfig);
00054
00055
00056 BOOST_AUTO_TEST_SUITE (master_test_suite)
00057
00058
00061 BOOST_AUTO_TEST_CASE (airrac_simple_yield) {
00062
00063
00064 stdair::TravelSolutionStruct lTravelSolution;
00065 stdair::TravelSolutionList_T lTravelSolutionList;
00066
00067
00068 const stdair::Filename_T lYieldInputFilename (STDAIR_SAMPLE_DIR
00069 "/yieldstore01.csv");
00070
00071
00072 bool doesExistAndIsReadable =
00073 stdair::BasFileMgr::doesExistAndIsReadable (lYieldInputFilename);
00074 BOOST_CHECK_MESSAGE (doesExistAndIsReadable == true,
00075 "The '" << lYieldInputFilename
00076 << "' input file can not be open and read");
00077
00078
00079 const stdair::Filename_T lLogFilename ("YieldTestSuite.log");
00080
00081
00082 std::ofstream logOutputFile;
00083
00084 logOutputFile.open (lLogFilename.c_str());
00085 logOutputFile.clear();
00086
00087
00088 const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
00089
00090 AIRRAC::AIRRAC_Service airracService (lLogParams);
00091
00092
00093 AIRRAC::YieldFilePath lYieldFilePath (lYieldInputFilename);
00094 airracService.parseAndLoad (lYieldFilePath);
00095
00096
00097 lTravelSolutionList.push_back(lTravelSolution);
00098 airracService.calculateYields (lTravelSolutionList);
00099
00100
00101 logOutputFile.close();
00102 }
00103
00104
00105 BOOST_AUTO_TEST_SUITE_END()
00106
00107