From: <den...@us...> - 2010-08-01 17:57:45
|
Revision: 250 http://stdair.svn.sourceforge.net/stdair/?rev=250&view=rev Author: denis_arnaud Date: 2010-08-01 17:57:39 +0000 (Sun, 01 Aug 2010) Log Message: ----------- [Doc] Added the tests to the documentation, and insulated those tests within a dedicated library for that purpose. Modified Paths: -------------- trunk/stdair/doc/Makefile.am trunk/stdair/doc/doxygen_html.cfg.in trunk/stdair/test/stdair/Makefile.am trunk/stdair/test/stdair/StandardAirlineITTestSuite.cpp trunk/stdair/test/stdair/StandardAirlineITTestSuite.hpp Added Paths: ----------- trunk/stdair/test/stdair/StdairTestLib.cpp trunk/stdair/test/stdair/StdairTestLib.hpp trunk/stdair/test/stdair/sources.mk Removed Paths: ------------- trunk/stdair/test/stdair/mpled_bom.cpp Property Changed: ---------------- trunk/stdair/test/stdair/ Modified: trunk/stdair/doc/Makefile.am =================================================================== --- trunk/stdair/doc/Makefile.am 2010-08-01 16:17:26 UTC (rev 249) +++ trunk/stdair/doc/Makefile.am 2010-08-01 17:57:39 UTC (rev 250) @@ -28,6 +28,7 @@ html/index.html: doxygen_html.cfg \ $(doc_local_sources) $(html_local_sources) \ $(doc_tutorial_sources) $(cpp_tutorial_sources) \ + $(stdair_test_lib_h_sources) $(stdair_test_lib_cc_sources) \ $(stdair_service_h_sources) $(stdair_service_cc_sources) \ $(stdair_bas_h_sources) $(stdair_bas_cc_sources) \ $(stdair_bom_h_sources) $(stdair_bom_cc_sources) \ Modified: trunk/stdair/doc/doxygen_html.cfg.in =================================================================== --- trunk/stdair/doc/doxygen_html.cfg.in 2010-08-01 16:17:26 UTC (rev 249) +++ trunk/stdair/doc/doxygen_html.cfg.in 2010-08-01 17:57:39 UTC (rev 250) @@ -576,7 +576,8 @@ INPUT = @top_srcdir@/@PACKAGE@ \ @top_srcdir@/doc/local \ - @top_srcdir@/doc/tutorial + @top_srcdir@/doc/tutorial \ + @top_srcdir@/test # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is @@ -653,7 +654,7 @@ # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. -EXAMPLE_RECURSIVE = NO +EXAMPLE_RECURSIVE = YES # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see Property changes on: trunk/stdair/test/stdair ___________________________________________________________________ Modified: svn:ignore - .deps .libs Makefile.in Makefile mpled_bom StandardAirlineITTestSuite StandardAirlineITTestSuite.log StandardAirlineITTestSuite_results.xml + .deps .libs Makefile.in Makefile StandardAirlineITTestSuite StandardAirlineITTestSuite_results.xml test*.log Modified: trunk/stdair/test/stdair/Makefile.am =================================================================== --- trunk/stdair/test/stdair/Makefile.am 2010-08-01 16:17:26 UTC (rev 249) +++ trunk/stdair/test/stdair/Makefile.am 2010-08-01 17:57:39 UTC (rev 250) @@ -1,5 +1,6 @@ ## test/stdair sub-directory include $(top_srcdir)/Makefile.common +include $(srcdir)/sources.mk MAINTAINERCLEANFILES = Makefile.in @@ -9,21 +10,28 @@ EXTRA_DIST = ## -check_PROGRAMS = mpled_bom StandardAirlineITTestSuite +## +# Test library +noinst_LTLIBRARIES = libstdairtest.la + +libstdairtest_la_SOURCES = $(stdair_test_lib_h_sources) \ + $(stdair_test_lib_cc_sources) +libstdairtest_la_CXXFLAGS = +libstdairtest_la_LDFLAGS = $(top_builddir)/stdair/core/libstdair.la + + +## +# Test binaries +check_PROGRAMS = StandardAirlineITTestSuite TESTS = $(check_PROGRAMS) -XFAIL_TESTS = #IndexBuildingTestSuite +XFAIL_TESTS = #FailingTestSuite # -mpled_bom_SOURCES = mpled_bom.cpp -mpled_bom_CXXFLAGS = $(BOOST_CFLAGS) -mpled_bom_LDADD = $(BOOST_LIB) - -# StandardAirlineITTestSuite_SOURCES = StandardAirlineITTestSuite.hpp \ StandardAirlineITTestSuite.cpp StandardAirlineITTestSuite_CXXFLAGS= $(BOOST_CFLAGS) $(CPPUNIT_CFLAGS) StandardAirlineITTestSuite_LDADD = StandardAirlineITTestSuite_LDFLAGS = $(BOOST_LIBS) $(CPPUNIT_LIBS) \ $(top_builddir)/extracppunit/libextracppunit.la \ + $(top_builddir)/test/stdair/libstdairtest.la \ $(top_builddir)/stdair/core/libstdair.la - Modified: trunk/stdair/test/stdair/StandardAirlineITTestSuite.cpp =================================================================== --- trunk/stdair/test/stdair/StandardAirlineITTestSuite.cpp 2010-08-01 16:17:26 UTC (rev 249) +++ trunk/stdair/test/stdair/StandardAirlineITTestSuite.cpp 2010-08-01 17:57:39 UTC (rev 250) @@ -1,3 +1,6 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// // STL #include <iostream> #include <string> @@ -3,48 +6,32 @@ // CPPUNIT #include <extracppunit/CppUnitCore.hpp> -// STDAIR -//#include <stdair/STDAIR_Service.hpp> -// STDAIR Test Suite +// StdAir Test Suite +#include <test/stdair/StdairTestLib.hpp> #include <test/stdair/StandardAirlineITTestSuite.hpp> // ////////////////////////////////////////////////////////////////////// -void testStandardAirlineITHelper() { +void StandardAirlineITTestSuite::testServiceInitialisation() { + CPPUNIT_ASSERT_NO_THROW ( StdairTestLib::testServiceInitialisation(); ); +} - try { - - // Output log File - const std::string lLogFilename ("StandardAirlineITTestSuite.log"); - - // Set the log parameters - std::ofstream logOutputFile; - - // Open and clean the log outputfile - logOutputFile.open (lLogFilename.c_str()); - logOutputFile.clear(); - - // Initialise the stdair BOM - // STDAIR::STDAIR_Service stdairService (logOutputFile); - - } catch (const std::exception& stde) { - std::cerr << "Standard exception: " << stde.what() << std::endl; - - } catch (...) { - std::cerr << "Unknown exception" << std::endl; - } +// ////////////////////////////////////////////////////////////////////// +void StandardAirlineITTestSuite::testMPLStructure() { + CPPUNIT_ASSERT_NO_THROW ( StdairTestLib::testMPLStructure(); ); } // ////////////////////////////////////////////////////////////////////// -void StandardAirlineITTestSuite::testStandardAirlineIT() { - CPPUNIT_ASSERT_NO_THROW (testStandardAirlineITHelper();); +void StandardAirlineITTestSuite::testBomStructureInstantiation() { + CPPUNIT_ASSERT_NO_THROW ( StdairTestLib::testBomStructureInstantiation(); ); } // ////////////////////////////////////////////////////////////////////// -// void StandardAirlineITTestSuite::errorCase () { -// CPPUNIT_ASSERT (false); -// } +void StandardAirlineITTestSuite::testErrorCase () { + const bool shouldBeFalse = StdairTestLib::testErrorCase(); + CPPUNIT_ASSERT ( shouldBeFalse ); +} // ////////////////////////////////////////////////////////////////////// StandardAirlineITTestSuite::StandardAirlineITTestSuite () { - _describeKey << "Running test on STDAIR Optimisation function"; + _describeKey << "Running test on StdAir initialisation"; } Modified: trunk/stdair/test/stdair/StandardAirlineITTestSuite.hpp =================================================================== --- trunk/stdair/test/stdair/StandardAirlineITTestSuite.hpp 2010-08-01 16:17:26 UTC (rev 249) +++ trunk/stdair/test/stdair/StandardAirlineITTestSuite.hpp 2010-08-01 17:57:39 UTC (rev 250) @@ -1,22 +1,49 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// // STL -#include <sstream> +#include <iosfwd> // CPPUNIT #include <cppunit/extensions/HelperMacros.h> +/** + * Class wrapping test functions + */ class StandardAirlineITTestSuite : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE (StandardAirlineITTestSuite); - CPPUNIT_TEST (testStandardAirlineIT); - // CPPUNIT_TEST (errorCase); + CPPUNIT_TEST (testServiceInitialisation); + CPPUNIT_TEST (testMPLStructure); + CPPUNIT_TEST (testBomStructureInstantiation); + // CPPUNIT_TEST (testErrorCase); CPPUNIT_TEST_SUITE_END (); public: - /** Test the Standard Airline IT base library. */ - void testStandardAirlineIT (); + /** + * Test MPL-based type handling, just as a proof-of-concept. It does + * not use StdAir BOM. + */ + void testServiceInitialisation(); - /** Test some error detection functionalities. */ - // void errorCase (); + /** + * Test MPL-based type handling, just as a proof-of-concept. It does + * not use StdAir BOM. + */ + void testMPLStructure(); - /** Constructor. */ + /** + * Test the initialisation of Standard Airline IT BOM objects. + */ + void testBomStructureInstantiation(); + + /** + * Test some error detection functionalities. + */ + void testErrorCase (); + + /** + * Default constructor. + * + */ StandardAirlineITTestSuite (); protected: Copied: trunk/stdair/test/stdair/StdairTestLib.cpp (from rev 248, trunk/stdair/test/stdair/StandardAirlineITTestSuite.cpp) =================================================================== --- trunk/stdair/test/stdair/StdairTestLib.cpp (rev 0) +++ trunk/stdair/test/stdair/StdairTestLib.cpp 2010-08-01 17:57:39 UTC (rev 250) @@ -0,0 +1,340 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <iostream> +#include <fstream> +#include <string> +// MPL +#include <boost/mpl/push_back.hpp> +#include <boost/mpl/vector.hpp> +#include <boost/mpl/at.hpp> +#include <boost/mpl/assert.hpp> +#include <boost/type_traits/is_same.hpp> +// StdAir +#include <stdair/STDAIR_Service.hpp> +#include <stdair/STDAIR_Types.hpp> +#include <stdair/bom/BomList.hpp> +#include <stdair/bom/BomSource.hpp> +#include <stdair/factory/FacBomContent.hpp> +#include <stdair/service/Logger.hpp> +#include <test/stdair/StdairTestLib.hpp> + +/** + * Namespace gathering classes and structures for test purposes + */ +namespace stdair_test { + + /** BookingClass */ + struct BookingClass { + std::string _classCode; + /** Constructor. */ + BookingClass (const std::string& iClassCode) + : _classCode (iClassCode) { + } + + /** Display .*/ + std::string toString() const { + std::ostringstream oStr; + oStr << _classCode; + return oStr.str(); + } + }; + + /** Cabin */ + struct Cabin { + BookingClass _bookingClass; + Cabin (const BookingClass& iBkgClass) + : _bookingClass (iBkgClass) { + } + + /** Display .*/ + std::string toString() const { + std::ostringstream oStr; + oStr << _bookingClass._classCode; + return oStr.str(); + } + + /** Child type. */ + typedef BookingClass child; + }; +} + +// ////////////////////////////////////////////////////////////////////// +void StdairTestLib::testMPLStructure() { + + // Output log File + const std::string lLogFilename ("testMPLStructure.log"); + + // Set the log parameters + std::ofstream logOutputFile; + + // Open and clean the log outputfile + logOutputFile.open (lLogFilename.c_str()); + logOutputFile.clear(); + + // Initialise the stdair BOM + const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile); + stdair::STDAIR_Service stdairService (lLogParams); + + // DEBUG + STDAIR_LOG_DEBUG ("StdAir service initialised"); + + typedef boost::mpl::vector<stdair_test::BookingClass> MPL_BookingClass; + typedef boost::mpl::push_back<MPL_BookingClass, + stdair_test::Cabin>::type types; + + const stdair_test::BookingClass lA ("A"); + const stdair_test::Cabin lCabin (lA); + + // lCabin::type + if (boost::is_same<stdair_test::BookingClass, + stdair_test::Cabin::child>::value) { + STDAIR_LOG_DEBUG ("The type of the child of a Cabin is a BookingClass"); + + } else { + STDAIR_LOG_DEBUG ("The type of " << lCabin.toString() + << " is unknown"); + } + + if (boost::is_same<boost::mpl::at_c<types, 1>::type, + stdair_test::Cabin>::value) { + STDAIR_LOG_DEBUG ("The 2nd type is STDAIR::Cabin"); + + } else { + STDAIR_LOG_ERROR ("Problem!"); + } + +BOOST_MPL_ASSERT ((boost::is_same<boost::mpl::at_c<types, 1>::type, + stdair_test::Cabin>)); +} + +// ////////////////////////////////////////////////////////////////////// +void StdairTestLib::testServiceInitialisation() { + + // Output log File + const std::string lLogFilename ("testServiceInitialisation.log"); + + // Set the log parameters + std::ofstream logOutputFile; + + // Open and clean the log outputfile + logOutputFile.open (lLogFilename.c_str()); + logOutputFile.clear(); + + // Initialise the stdair BOM + const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile); + stdair::STDAIR_Service stdairService (lLogParams); + + // DEBUG + STDAIR_LOG_DEBUG ("StdAir service initialised"); +} + +// ////////////////////////////////////////////////////////////////////// +void StdairTestLib::testBomStructureInstantiation() { + + // Test create objects. + + // Output log File + std::string lLogFilename ("testBomStructureInstantiation.log"); + + // Set the log parameters + std::ofstream logOutputFile; + // open and clean the log outputfile + logOutputFile.open (lLogFilename.c_str()); + logOutputFile.clear(); + + const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile); + stdair::STDAIR_Service stdairService (lLogParams); + + // DEBUG + STDAIR_LOG_DEBUG ("StdAir service initialised"); + + // Step 0.0: initialisation + // Create the root of the Bom tree (i.e., a BomRoot object) + stdair::BomRoot& lBomRoot = + stdair::FacBomContent::instance().create<stdair::BomRoot>(); + + + // Step 0.1: Inventory level + // Create an Inventory (BA) + const stdair::AirlineCode_T lAirlineCode ("BA"); + stdair::InventoryKey_T lInventoryKey (lAirlineCode); + + stdair::Inventory& lInventory = + stdair::FacBomContent::instance().create<stdair::Inventory>(lInventoryKey); + stdair::FacBomContent::linkWithParent (lInventory, lBomRoot); + + // Display the inventory + STDAIR_LOG_DEBUG ("Inventory: " << lInventory.toString()); + + // Step 0.2: Flight-date level + // Create a FlightDate (BA15/10-JUN-2010) + const stdair::FlightNumber_T lFlightNumber = 15; + const stdair::Date_T lDate (2010, 6, 10); + stdair::FlightDateKey_T lFlightDateKey (lFlightNumber, lDate); + + stdair::FlightDate& lFlightDate = stdair::FacBomContent:: + instance().create<stdair::FlightDate> (lFlightDateKey); + stdair::FacBomContent::linkWithParent (lFlightDate, lInventory); + + // Display the flight-date + STDAIR_LOG_DEBUG ("FlightDate: " << lFlightDate.toString()); + + // Step 0.3: Segment-date level + // Create a first SegmentDate (LHR-SYD) + const stdair::AirportCode_T lLHR ("LHR"); + const stdair::AirportCode_T lSYD ("SYD"); + stdair::SegmentDateKey_T lSegmentDateKey (lLHR, lSYD); + + stdair::SegmentDate& lLHRSYDSegment = + stdair::FacBomContent:: + instance().create<stdair::SegmentDate> (lSegmentDateKey); + stdair::FacBomContent::linkWithParent (lLHRSYDSegment, lFlightDate); + + // Display the segment-date + STDAIR_LOG_DEBUG ("SegmentDate: " << lLHRSYDSegment.toString()); + + + // Create a second SegmentDate (LHR-BKK) + const stdair::AirportCode_T lBKK ("BKK"); + lSegmentDateKey = stdair::SegmentDateKey_T (lLHR, lBKK); + + stdair::SegmentDate& lLHRBKKSegment = + stdair::FacBomContent:: + instance().create<stdair::SegmentDate> (lSegmentDateKey); + stdair::FacBomContent::linkWithParent (lLHRBKKSegment, lFlightDate); + + // Display the segment-date + STDAIR_LOG_DEBUG ("SegmentDate: " << lLHRBKKSegment.toString()); + + + // Create a third SegmentDate (BKK-SYD) + lSegmentDateKey = stdair::SegmentDateKey_T (lBKK, lSYD); + + stdair::SegmentDate& lBKKSYDSegment = + stdair::FacBomContent:: + instance().create<stdair::SegmentDate> (lSegmentDateKey); + stdair::FacBomContent::linkWithParent (lBKKSYDSegment, lFlightDate); + + // Display the segment-date + STDAIR_LOG_DEBUG ("SegmentDate: " << lBKKSYDSegment.toString()); + + + // Step 0.4: Leg-date level + // Create a first LegDate (LHR) + stdair::LegDateKey_T lLegDateKey (lLHR); + + stdair::LegDate& lLHRLeg = + stdair::FacBomContent::instance().create<stdair::LegDate> (lLegDateKey); + stdair::FacBomContent::linkWithParent<stdair::LegDate>(lLHRLeg, lFlightDate); + + // Display the leg-date + STDAIR_LOG_DEBUG ("LegDate: " << lLHRLeg.toString()); + + // Create a second LegDate (BKK) + lLegDateKey = stdair::LegDateKey_T (lBKK); + + stdair::LegDate& lBKKLeg = + stdair::FacBomContent::instance().create<stdair::LegDate> (lLegDateKey); + stdair::FacBomContent::linkWithParent (lBKKLeg, lFlightDate); + + // Display the leg-date + STDAIR_LOG_DEBUG ("LegDate: " << lBKKLeg.toString()); + + // Step 0.5: segment-cabin level + // Create a SegmentCabin (Y) of the Segment LHR-BKK; + const stdair::CabinCode_T lY ("Y"); + stdair::SegmentCabinKey_T lYSegmentCabinKey (lY); + + stdair::SegmentCabin& lLHRBKKSegmentYCabin = + stdair::FacBomContent:: + instance().create<stdair::SegmentCabin> (lYSegmentCabinKey); + stdair::FacBomContent:: + linkWithParent (lLHRBKKSegmentYCabin, lLHRBKKSegment); + + // Display the segment-cabin + STDAIR_LOG_DEBUG ("SegmentCabin: " << lLHRBKKSegmentYCabin.toString()); + + // Create a SegmentCabin (Y) of the Segment BKK-SYD; + stdair::SegmentCabin& lBKKSYDSegmentYCabin = + stdair::FacBomContent:: + instance().create<stdair::SegmentCabin> (lYSegmentCabinKey); + stdair::FacBomContent:: + linkWithParent (lBKKSYDSegmentYCabin, lBKKSYDSegment); + + // Display the segment-cabin + STDAIR_LOG_DEBUG ("SegmentCabin: " << lBKKSYDSegmentYCabin.toString()); + + // Create a SegmentCabin (Y) of the Segment LHR-SYD; + stdair::SegmentCabin& lLHRSYDSegmentYCabin = + stdair::FacBomContent:: + instance().create<stdair::SegmentCabin> (lYSegmentCabinKey); + stdair::FacBomContent:: + linkWithParent (lLHRSYDSegmentYCabin, lLHRSYDSegment); + + // Display the segment-cabin + STDAIR_LOG_DEBUG ("SegmentCabin: " << lLHRSYDSegmentYCabin.toString()); + + + // Step 0.6: leg-cabin level + // Create a LegCabin (Y) of the Leg LHR-BKK; + stdair::LegCabinKey_T lYLegCabinKey (lY); + + stdair::LegCabin& lLHRLegYCabin = + stdair::FacBomContent::instance().create<stdair::LegCabin> (lYLegCabinKey); + stdair::FacBomContent::linkWithParent (lLHRLegYCabin, lLHRLeg); + + // Display the leg-cabin + STDAIR_LOG_DEBUG ("LegCabin: " << lLHRLegYCabin.toString()); + + // Create a LegCabin (Y) of the Leg BKK-SYD; + stdair::LegCabin& lBKKLegYCabin = + stdair::FacBomContent::instance().create<stdair::LegCabin> (lYLegCabinKey); + stdair::FacBomContent::linkWithParent (lBKKLegYCabin, lBKKLeg); + + // Display the leg-cabin + STDAIR_LOG_DEBUG ("LegCabin: " << lBKKLegYCabin.toString()); + + // Step 0.7: booking class level + // Create a BookingClass (Q) of the Segment LHR-BKK, cabin Y; + const stdair::ClassCode_T lQ ("Q"); + stdair::BookingClassKey_T lQBookingClassKey (lQ); + + stdair::BookingClass& lLHRBKKSegmentYCabinQClass = + stdair::FacBomContent:: + instance().create<stdair::BookingClass> (lQBookingClassKey); + stdair::FacBomContent:: + linkWithParent (lLHRBKKSegmentYCabinQClass, lLHRBKKSegmentYCabin); + + // Display the booking class + STDAIR_LOG_DEBUG ("BookingClass: " + << lLHRBKKSegmentYCabinQClass.toString()); + + // Browse the BomRoot and display the created objects. + STDAIR_LOG_DEBUG ("Browse the BomRoot"); + + const stdair::InventoryList_T& lInventoryList = lBomRoot.getInventoryList(); + for (stdair::InventoryList_T::iterator itInv = lInventoryList.begin(); + itInv != lInventoryList.end(); ++itInv) { + const stdair::Inventory& lCurrentInventory = *itInv; + STDAIR_LOG_DEBUG ("Inventory: " << lCurrentInventory.toString()); + + const stdair::FlightDateMap_T& lFlightDateMap = + lCurrentInventory.getFlightDateMap (); + for (stdair::FlightDateMap_T::iterator itFlightDate = + lFlightDateMap.begin(); + itFlightDate != lFlightDateMap.end(); ++itFlightDate) { + const stdair::FlightDate* lCurrentFlightDate = itFlightDate->second; + STDAIR_LOG_DEBUG ("FlightDate: " << lCurrentFlightDate->describeKey()); + } + } + + // Close the Log outputFile + logOutputFile.close(); +} + +// ////////////////////////////////////////////////////////////////////// +bool StdairTestLib::testErrorCase() { + return false; +} Copied: trunk/stdair/test/stdair/StdairTestLib.hpp (from rev 248, trunk/stdair/test/stdair/StandardAirlineITTestSuite.hpp) =================================================================== --- trunk/stdair/test/stdair/StdairTestLib.hpp (rev 0) +++ trunk/stdair/test/stdair/StdairTestLib.hpp 2010-08-01 17:57:39 UTC (rev 250) @@ -0,0 +1,59 @@ +#ifndef __STDAIR_TST_STDAIR_TEST_LIB_HPP +#define __STDAIR_TST_STDAIR_TEST_LIB_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// + +/** + * Class wrapping test functions + */ +class StdairTestLib { +public: + + /** + * Test the initialisation of the Standard Airline IT base library. + */ + static void testServiceInitialisation(); + + /** + * Test MPL-based type handling, just as a proof-of-concept. It does + * not use StdAir BOM. + */ + static void testMPLStructure(); + + /** + * Test the initialisation of Standard Airline IT BOM objects. + */ + static void testBomStructureInstantiation(); + + /** + * Test some error detection functionalities. + */ + static bool testErrorCase(); + +private: + /** + * Default constructor. + * + * It should not be used, as all the methods + * are defined as static. + */ + StdairTestLib() {} + + /** + * Default copy constructor. + * + * It should not be used, as all the methods + * are defined as static. + */ + StdairTestLib (const StdairTestLib&) {} + + /** + * Default copy constructor. + * + */ + ~StdairTestLib() {} +}; + +#endif // __STDAIR_TST_STDAIR_TEST_LIB_HPP Deleted: trunk/stdair/test/stdair/mpled_bom.cpp =================================================================== --- trunk/stdair/test/stdair/mpled_bom.cpp 2010-08-01 16:17:26 UTC (rev 249) +++ trunk/stdair/test/stdair/mpled_bom.cpp 2010-08-01 17:57:39 UTC (rev 250) @@ -1,82 +0,0 @@ -// STL -#include <iostream> -#include <sstream> -#include <string> -#include <vector> -// MPL -#include <boost/mpl/push_back.hpp> -#include <boost/mpl/vector.hpp> -#include <boost/mpl/at.hpp> -#include <boost/mpl/assert.hpp> -#include <boost/type_traits/is_same.hpp> - -// ////////////////////////////////////////////////////////////////// -namespace STDAIR { - - /** BookingClass */ - struct BookingClass { - std::string _classCode; - /** Constructor. */ - BookingClass (const std::string& iClassCode) - : _classCode (iClassCode) { - } - - /** Display .*/ - std::string toString() const { - std::ostringstream oStr; - oStr << _classCode; - return oStr.str(); - } - }; - - /** Cabin */ - struct Cabin { - BookingClass _bookingClass; - Cabin (const BookingClass& iBkgClass) - : _bookingClass (iBkgClass) { - } - - /** Display .*/ - std::string toString() const { - std::ostringstream oStr; - oStr << _bookingClass._classCode; - return oStr.str(); - } - - /** Child type. */ - typedef BookingClass child; - }; - -} - -// /////////// M A I N //////////////// -int main (int argc, char* argv[]) { - - typedef boost::mpl::vector<STDAIR::BookingClass> MPL_BookingClass; - typedef boost::mpl::push_back<MPL_BookingClass, STDAIR::Cabin>::type types; - - const STDAIR::BookingClass lA ("A"); - const STDAIR::Cabin lCabin (lA); - - // lCabin::type - if (boost::is_same<STDAIR::BookingClass, STDAIR::Cabin::child>::value) { - std::cout << "The type of the child of a Cabin is a BookingClass" - << std::endl; - - } else { - std::cout << "The type of " << lCabin.toString() << " is unknown" - << std::endl; - } - - if (boost::is_same<boost::mpl::at_c<types, 1>::type, STDAIR::Cabin>::value) { - std::cout << "The 2nd type is STDAIR::Cabin" << std::endl; - - } else { - std::cout << "Problem!" << std::endl; - } - - BOOST_MPL_ASSERT ((boost::is_same<boost::mpl::at_c<types, 1>::type, - STDAIR::Cabin>)); - - return 0; -} Copied: trunk/stdair/test/stdair/sources.mk (from rev 248, trunk/stdair/stdair/service/sources.mk) =================================================================== --- trunk/stdair/test/stdair/sources.mk (rev 0) +++ trunk/stdair/test/stdair/sources.mk 2010-08-01 17:57:39 UTC (rev 250) @@ -0,0 +1,4 @@ +stdair_test_lib_h_sources = \ + $(top_srcdir)/test/stdair/StdairTestLib.hpp +stdair_test_lib_cc_sources = \ + $(top_srcdir)/test/stdair/StdairTestLib.cpp This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |