X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2Fmpl.test.cc;h=25d6f0cd9a287543d31524d307dd55337803c08f;hb=532240d72e09e19e57fac9bb55c2560b9c9e5b97;hp=9935670c9211df2f4226cf65a62c30d0979fbaec;hpb=21bad90912447cd2d390112cf2d2a7d383ad8058;p=senf.git diff --git a/Utils/mpl.test.cc b/Utils/mpl.test.cc index 9935670..25d6f0c 100644 --- a/Utils/mpl.test.cc +++ b/Utils/mpl.test.cc @@ -1,8 +1,8 @@ // $Id$ // -// Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// Copyright (C) 2007 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify @@ -21,7 +21,7 @@ // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /** \file - \brief mpl.test unit tests */ + \brief mpl unit tests */ //#include "mpl.test.hh" //#include "mpl.test.ih" @@ -29,15 +29,15 @@ // Custom includes #include "mpl.hh" -#include +#include "../Utils/auto_unit_test.hh" #include #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// namespace { - - template + + template struct select { static bool const has_int_value = false; static bool const has_class_value = false; @@ -62,7 +62,7 @@ namespace { template senf::mpl::rv<2> select_(int, senf::mpl::take_class * = 0); - template + template struct choice : public select(0) )> {}; struct A { static const int value = 0; }; @@ -70,7 +70,7 @@ namespace { struct C {}; } -BOOST_AUTO_UNIT_TEST(senfmpl) +BOOST_AUTO_UNIT_TEST(senfmpl) { BOOST_CHECK( choice::has_int_value ); BOOST_CHECK( ! choice::has_class_value ); @@ -82,6 +82,33 @@ BOOST_AUTO_UNIT_TEST(senfmpl) BOOST_CHECK( ! choice::has_class_value ); } +namespace { + +# define Begin() SENF_MPL_SLOT_DEF(accum, 0) +# define Add(n) SENF_MPL_SLOT_SET(accum, SENF_MPL_SLOT_GET(accum)+n) +# define End() BOOST_STATIC_CONSTANT(unsigned, total = SENF_MPL_SLOT_GET(accum)) + + struct Test + { + Begin(); + + Add(2); + Add(2); + + // Here some comment ... + + Add(4); + + End(); + }; + +} + +BOOST_AUTO_UNIT_TEST(mplSlot) +{ + BOOST_CHECK_EQUAL( unsigned(Test::total), 8u ); +} + ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_