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> 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 #if BOOST_VERSION_MACRO >= 105900 44 boost_utf::unit_test_log.set_format (boost_utf::OF_XML);
45 #else // BOOST_VERSION_MACRO 46 boost_utf::unit_test_log.set_format (boost_utf::XML);
47 #endif // BOOST_VERSION_MACRO 48 boost_utf::unit_test_log.set_threshold_level (boost_utf::log_test_units);
60 void SimulationTest (
const unsigned short iTestFlag,
61 const stdair::Filename_T iScheduleInputFilename,
62 const stdair::Filename_T iOnDInputFilename,
63 const stdair::Filename_T iFRAT5InputFilename,
64 const stdair::Filename_T iFFDisutilityInputFilename,
65 const stdair::Filename_T iYieldInputFilename,
66 const stdair::Filename_T iFareInputFilename,
67 const stdair::Filename_T iDemandInputFilename,
68 const bool isBuiltin) {
71 const stdair::DemandGenerationMethod lOrderStatDemandGenMethod =
72 stdair::DemandGenerationMethod::STA_ORD;
75 const stdair::Date_T lStartDate (2009, boost::gregorian::Jan, 01);
78 const stdair::Date_T lEndDate (2011, boost::gregorian::Jan, 01);
81 const stdair::RandomSeed_T lRandomSeed (stdair::DEFAULT_RANDOM_SEED);
87 std::ostringstream oStr;
88 oStr <<
"SimpleSimulationTestSuite_" << iTestFlag <<
".log";
89 const stdair::Filename_T lLogFilename (oStr.str());
92 std::ofstream logOutputFile;
94 logOutputFile.open (lLogFilename.c_str());
95 logOutputFile.clear();
98 const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
101 lRandomSeed, lOrderStatDemandGenMethod,
105 if (isBuiltin ==
true) {
108 tvlsimService.buildSampleBom();
113 const stdair::ScheduleFilePath lScheduleFilePath (iScheduleInputFilename);
114 const stdair::ODFilePath lODFilePath (iOnDInputFilename);
115 const stdair::FRAT5FilePath lFRAT5FilePath (iFRAT5InputFilename);
116 const stdair::FFDisutilityFilePath lFFDisutilityFilePath (iFFDisutilityInputFilename);
117 const AIRRAC::YieldFilePath lYieldFilePath (iYieldInputFilename);
118 const SIMFQT::FareFilePath lFareFilePath (iFareInputFilename);
119 const TRADEMGEN::DemandFilePath lDemandFilePath (iDemandInputFilename);
122 tvlsimService.setInputFiles(lScheduleFilePath,
125 lFFDisutilityFilePath,
131 tvlsimService.parseAndLoad ();
135 tvlsimService.initSnapshotAndRMEvents();
138 tvlsimService.simulate ();
141 logOutputFile.close();
148 BOOST_GLOBAL_FIXTURE (UnitTestConfig);
151 BOOST_AUTO_TEST_SUITE (master_test_suite)
156 BOOST_AUTO_TEST_CASE (simple_simulation_test) {
159 const bool isBuiltin =
false;
163 "/rds01/schedule.csv");
174 "/ffDisutility.csv");
186 "/rds01/demand.csv");
189 BOOST_CHECK_NO_THROW (SimulationTest(0,
190 lScheduleInputFilename,
193 lFFDisutilityInputFilename,
196 lDemandInputFilename,
203 BOOST_AUTO_TEST_CASE (default_bom_simulation_test) {
206 const bool isBuiltin =
true;
209 BOOST_CHECK_NO_THROW (SimulationTest(1,
210 " ",
" ",
" ",
" ",
" ",
" ",
" ",
217 BOOST_AUTO_TEST_SUITE_END()
#define STDAIR_SAMPLE_DIR