From: <den...@us...> - 2009-12-29 13:51:40
|
Revision: 72 http://stdair.svn.sourceforge.net/stdair/?rev=72&view=rev Author: denis_arnaud Date: 2009-12-29 13:51:34 +0000 (Tue, 29 Dec 2009) Log Message: ----------- [Test] Re-worked the Boost.MPL tests. Modified Paths: -------------- trunk/stdair/configure.ac trunk/stdair/test/Makefile.am trunk/stdair/test/mpl/Makefile.am trunk/stdair/test/stdair/Makefile.am Added Paths: ----------- trunk/stdair/test/mpl/contrib/ trunk/stdair/test/mpl/contrib/Makefile.am trunk/stdair/test/mpl/mpl_book_ch_01.cpp trunk/stdair/test/stdair/mpled_bom.cpp Removed Paths: ------------- trunk/stdair/test/com/ trunk/stdair/test/mpl/book/Makefile.am trunk/stdair/test/mpl/book/ch_01.cpp trunk/stdair/test/mpl/book/contrib/ trunk/stdair/test/mpl/mpl.cpp trunk/stdair/test/mpl/test_mpl.sh Property Changed: ---------------- trunk/stdair/test/mpl/ trunk/stdair/test/mpl/book/ trunk/stdair/test/stdair/ Modified: trunk/stdair/configure.ac =================================================================== --- trunk/stdair/configure.ac 2009-12-29 10:48:15 UTC (rev 71) +++ trunk/stdair/configure.ac 2009-12-29 13:51:34 UTC (rev 72) @@ -204,7 +204,7 @@ test/Makefile test/inheritance/Makefile test/mpl/Makefile - test/mpl/book/Makefile + test/mpl/contrib/Makefile test/stdair/Makefile ) AC_OUTPUT Modified: trunk/stdair/test/Makefile.am =================================================================== --- trunk/stdair/test/Makefile.am 2009-12-29 10:48:15 UTC (rev 71) +++ trunk/stdair/test/Makefile.am 2009-12-29 13:51:34 UTC (rev 72) @@ -4,7 +4,7 @@ MAINTAINERCLEANFILES = Makefile.in ## -SUBDIRS = com inheritance mpl +SUBDIRS = inheritance mpl stdair EXTRA_DIST = ## Property changes on: trunk/stdair/test/mpl ___________________________________________________________________ Modified: svn:ignore - .deps .libs Makefile.in Makefile mpl + .deps .libs Makefile.in Makefile mpl_book_ch_?? Modified: trunk/stdair/test/mpl/Makefile.am =================================================================== --- trunk/stdair/test/mpl/Makefile.am 2009-12-29 10:48:15 UTC (rev 71) +++ trunk/stdair/test/mpl/Makefile.am 2009-12-29 13:51:34 UTC (rev 72) @@ -3,12 +3,15 @@ MAINTAINERCLEANFILES = Makefile.in -SUBDIRS = book +# +SUBDIRS = contrib -check_PROGRAMS = mpl +EXTRA_DIST = -mpl_SOURCES = mpl.cpp -mpl_CXXFLAGS = $(BOOST_CFLAGS) -mpl_LDADD = $(BOOST_LIB) +# +check_PROGRAMS = mpl_book_ch_01 -EXTRA_DIST = test_mpl.sh +# +mpl_book_ch_01_SOURCES = mpl_book_ch_01.cpp +mpl_book_ch_01_CXXFLAGS = $(BOOST_CFLAGS) +mpl_book_ch_01_LDADD = $(BOOST_LIBS) Property changes on: trunk/stdair/test/mpl/book ___________________________________________________________________ Modified: svn:ignore - .deps .libs Makefile.in Makefile ch?? + .deps .libs Makefile.in Makefile Deleted: trunk/stdair/test/mpl/book/Makefile.am =================================================================== --- trunk/stdair/test/mpl/book/Makefile.am 2009-12-29 10:48:15 UTC (rev 71) +++ trunk/stdair/test/mpl/book/Makefile.am 2009-12-29 13:51:34 UTC (rev 72) @@ -1,12 +0,0 @@ -## command sub-directory -include $(top_srcdir)/Makefile.common - -MAINTAINERCLEANFILES = Makefile.in - -check_PROGRAMS = ch01 - -ch01_SOURCES = ch_01.cpp -ch01_CXXFLAGS = $(BOOST_CFLAGS) -ch01_LDADD = $(BOOST_LIB) - -EXTRA_DIST = Deleted: trunk/stdair/test/mpl/book/ch_01.cpp =================================================================== --- trunk/stdair/test/mpl/book/ch_01.cpp 2009-12-29 10:48:15 UTC (rev 71) +++ trunk/stdair/test/mpl/book/ch_01.cpp 2009-12-29 13:51:34 UTC (rev 72) @@ -1,13 +0,0 @@ -// STL -#include <iostream> -// Book on Boost MPL -#include "contrib/binary.hpp" - -// ///////////// M A I N ////////////// -int main (int argc, char* argv[]) { - - const long l42 = binary<101010>::value; - std::cout << "The 101010 binary number is equal to: " << l42 << std::endl; - - return 0; -} Property changes on: trunk/stdair/test/mpl/contrib ___________________________________________________________________ Added: svn:ignore + .deps .libs Makefile.in Makefile Copied: trunk/stdair/test/mpl/contrib/Makefile.am (from rev 70, trunk/stdair/test/mpl/book/Makefile.am) =================================================================== --- trunk/stdair/test/mpl/contrib/Makefile.am (rev 0) +++ trunk/stdair/test/mpl/contrib/Makefile.am 2009-12-29 13:51:34 UTC (rev 72) @@ -0,0 +1,8 @@ +## test/boost/mpl/contrib sub-directory +include $(top_srcdir)/Makefile.common + +MAINTAINERCLEANFILES = Makefile.in + +check_PROGRAMS = + +EXTRA_DIST = binary.hpp Deleted: trunk/stdair/test/mpl/mpl.cpp =================================================================== --- trunk/stdair/test/mpl/mpl.cpp 2009-12-29 10:48:15 UTC (rev 71) +++ trunk/stdair/test/mpl/mpl.cpp 2009-12-29 13:51:34 UTC (rev 72) @@ -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/mpl/mpl_book_ch_01.cpp (from rev 70, trunk/stdair/test/mpl/book/ch_01.cpp) =================================================================== --- trunk/stdair/test/mpl/mpl_book_ch_01.cpp (rev 0) +++ trunk/stdair/test/mpl/mpl_book_ch_01.cpp 2009-12-29 13:51:34 UTC (rev 72) @@ -0,0 +1,13 @@ +// STL +#include <iostream> +// Book on Boost MPL +#include "contrib/binary.hpp" + +// ///////////// M A I N ////////////// +int main (int argc, char* argv[]) { + + const long l42 = binary<101010>::value; + std::cout << "The 101010 binary number is equal to: " << l42 << std::endl; + + return 0; +} Deleted: trunk/stdair/test/mpl/test_mpl.sh =================================================================== --- trunk/stdair/test/mpl/test_mpl.sh 2009-12-29 10:48:15 UTC (rev 71) +++ trunk/stdair/test/mpl/test_mpl.sh 2009-12-29 13:51:34 UTC (rev 72) @@ -1,25 +0,0 @@ -#!/bin/sh - -INSTALL_DIR=`grep "^prefix =" ../Makefile | cut -d"=" -d" " -f3` -TST_PROG=./mpl -LATUS_API_VERSION=`grep "^LATUS_API_VERSION =" ../Makefile | cut -d"=" -d" " -f3` -LATUS_LIBRARY_NAME=`grep "^LATUS_LIBRARY_NAME =" ../Makefile | cut -d"=" -d" " -f3` -LATUS_LIB=lib${LATUS_LIBRARY_NAME}-${LATUS_API_VERSION}.so - -if [ ! -x ${TST_PROG} ]; -then - echo "The sample program does not seem to have been compiled. Try 'make check' first." - exit -1 -fi - -if [ "$1" = "-h" -o "$1" = "-H" -o "$1" = "--h" -o "$1" = "--help" ]; -then - echo "Usage: $0 [<String to be parsed>]" - echo " The list to be parsed should contain floating point numbers" - echo " separated by commas, and should not contain spaces." - echo " Example: 10.2,5.4" - echo "The program parses a line and fills a flight-period structure." - exit 0 -fi - -${TST_PROG} $1 Property changes on: trunk/stdair/test/stdair ___________________________________________________________________ Modified: svn:ignore - .deps .libs Makefile.in Makefile StandardAirlineITTestSuite StandardAirlineITTestSuite.log StandardAirlineITTestSuite_results.xml + .deps .libs Makefile.in Makefile mpled_bom StandardAirlineITTestSuite StandardAirlineITTestSuite.log StandardAirlineITTestSuite_results.xml Modified: trunk/stdair/test/stdair/Makefile.am =================================================================== --- trunk/stdair/test/stdair/Makefile.am 2009-12-29 10:48:15 UTC (rev 71) +++ trunk/stdair/test/stdair/Makefile.am 2009-12-29 13:51:34 UTC (rev 72) @@ -9,10 +9,16 @@ EXTRA_DIST = ## -check_PROGRAMS = StandardAirlineITTestSuite +check_PROGRAMS = mpled_bom StandardAirlineITTestSuite TESTS = $(check_PROGRAMS) XFAIL_TESTS = #IndexBuildingTestSuite +# +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) Copied: trunk/stdair/test/stdair/mpled_bom.cpp (from rev 70, trunk/stdair/test/mpl/mpl.cpp) =================================================================== --- trunk/stdair/test/stdair/mpled_bom.cpp (rev 0) +++ trunk/stdair/test/stdair/mpled_bom.cpp 2009-12-29 13:51:34 UTC (rev 72) @@ -0,0 +1,82 @@ +// 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; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |