13 #define BOOST_TEST_DYN_LINK
14 #define BOOST_TEST_MAIN
15 #define BOOST_TEST_MODULE SimulationTestSuite
16 #include <boost/test/unit_test.hpp>
18 #include <stdair/stdair_exceptions.hpp>
19 #include <stdair/basic/BasConst_General.hpp>
20 #include <stdair/basic/BasLogParams.hpp>
21 #include <stdair/basic/BasFileMgr.hpp>
22 #include <stdair/basic/DemandGenerationMethod.hpp>
23 #include <stdair/service/Logger.hpp>
25 #include <simfqt/SIMFQT_Types.hpp>
29 #include <tvlsim/config/tvlsim-paths.hpp>
31 namespace boost_utf = boost::unit_test;
34 std::ofstream utfReportStream (
"SimulationTestSuite_utfresults.xml");
39 struct UnitTestConfig {
42 boost_utf::unit_test_log.set_stream (utfReportStream);
43 boost_utf::unit_test_log.set_format (boost_utf::XML);
44 boost_utf::unit_test_log.set_threshold_level (boost_utf::log_test_units);
56 void SimulationTest (
const unsigned short iTestFlag,
57 const stdair::Filename_T iScheduleInputFilename,
58 const stdair::Filename_T iOnDInputFilename,
59 const stdair::Filename_T iFRAT5InputFilename,
60 const stdair::Filename_T iFFDisutilityInputFilename,
61 const stdair::Filename_T iYieldInputFilename,
62 const stdair::Filename_T iFareInputFilename,
63 const stdair::Filename_T iDemandInputFilename,
64 const bool isBuiltin) {
67 const stdair::DemandGenerationMethod lOrderStatDemandGenMethod =
68 stdair::DemandGenerationMethod::STA_ORD;
71 const stdair::Date_T lStartDate (2009, boost::gregorian::Jan, 01);
74 const stdair::Date_T lEndDate (2011, boost::gregorian::Jan, 01);
77 const stdair::RandomSeed_T lRandomSeed (stdair::DEFAULT_RANDOM_SEED);
83 std::ostringstream oStr;
84 oStr <<
"SimpleSimulationTestSuite_" << iTestFlag <<
".log";
85 const stdair::Filename_T lLogFilename (oStr.str());
88 std::ofstream logOutputFile;
90 logOutputFile.open (lLogFilename.c_str());
91 logOutputFile.clear();
94 const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
97 lRandomSeed, lOrderStatDemandGenMethod,
101 if (isBuiltin ==
true) {
104 tvlsimService.buildSampleBom();
109 const stdair::ScheduleFilePath lScheduleFilePath (iScheduleInputFilename);
110 const stdair::ODFilePath lODFilePath (iOnDInputFilename);
111 const stdair::FRAT5FilePath lFRAT5FilePath (iFRAT5InputFilename);
112 const stdair::FFDisutilityFilePath lFFDisutilityFilePath (iFFDisutilityInputFilename);
113 const AIRRAC::YieldFilePath lYieldFilePath (iYieldInputFilename);
114 const SIMFQT::FareFilePath lFareFilePath (iFareInputFilename);
115 const TRADEMGEN::DemandFilePath lDemandFilePath (iDemandInputFilename);
118 tvlsimService.setInputFiles(lScheduleFilePath,
121 lFFDisutilityFilePath,
127 tvlsimService.parseAndLoad ();
131 tvlsimService.initSnapshotAndRMEvents();
134 tvlsimService.simulate ();
137 logOutputFile.close();
144 BOOST_GLOBAL_FIXTURE (UnitTestConfig);
147 BOOST_AUTO_TEST_SUITE (master_test_suite)
152 BOOST_AUTO_TEST_CASE (simple_simulation_test) {
155 const bool isBuiltin =
false;
159 "/rds01/schedule.csv");
170 "/ffDisutility.csv");
182 "/rds01/demand.csv");
185 BOOST_CHECK_NO_THROW (SimulationTest(0,
186 lScheduleInputFilename,
189 lFFDisutilityInputFilename,
192 lDemandInputFilename,
199 BOOST_AUTO_TEST_CASE (default_bom_simulation_test) {
202 const bool isBuiltin =
true;
205 BOOST_CHECK_NO_THROW (SimulationTest(1,
206 " ",
" ",
" ",
" ",
" ",
" ",
" ",
213 BOOST_AUTO_TEST_SUITE_END()