diff --git a/src/lib/meta/tuple.hpp b/src/lib/meta/tuple.hpp index f95816824..ec8f5dd72 100644 --- a/src/lib/meta/tuple.hpp +++ b/src/lib/meta/tuple.hpp @@ -36,6 +36,7 @@ ** might come in handy. ** ** @see control::CommandDef usage example + ** @see tuple-test.cpp ** @see typelist.hpp ** @see function.hpp ** @see generator.hpp diff --git a/tests/40components.tests b/tests/40components.tests index e28e5445f..85bfb6c2d 100644 --- a/tests/40components.tests +++ b/tests/40components.tests @@ -550,6 +550,11 @@ return: 0 END +PLANNED "TypeTuple_test" TypeTuple_test < + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + + +/** @file type-tuple-test.cpp + ** Interconnection of typelists, type tuples and simple record + ** data types build on top of them. + ** @todo define function-closure-test + ** + ** @see lumiera::typelist::Tuple + ** @see tuple.hpp + ** @see function-closure.hpp + ** @see control::CmdClosure real world usage example + ** + */ + + +#include "lib/test/run.hpp" +#include "lib/meta/typelist.hpp" ////////////TODO really? +#include "lib/meta/tuple.hpp" +#include "meta/typelist-diagnostics.hpp" +//#include "lib/util.hpp" + +//#include +#include + +using ::test::Test; +using std::string; +using std::cout; + + +namespace lumiera { +namespace typelist{ +namespace test { + + + namespace { // test data + + + + typedef Types< Num<1> + , Num<2> + , Num<3> + >::List List1; + typedef Types< Num<5> + , Num<6> + , Num<7> + >::List List2; + + + template struct CountDown { typedef NullType List; }; + template<> struct CountDown > { typedef Node, NullType> List; }; + template struct CountDown > { typedef Node, typename CountDown >::List> List; }; + + + + } // (End) test data + + + + + + + /************************************************************************* + * @test ////////////////////////////////////////// + * - building combinations and permutations + */ + class TypeTuple_test : public Test + { + virtual void + run (Arg) + { + UNIMPLEMENTED ("verify type tuples"); + } + }; + + + /** Register this test class... */ + LAUNCHER (TypeTuple_test, "unit common"); + + + +}}} // namespace lumiera::typelist::test diff --git a/tests/lib/meta/typelist-diagnostics.hpp b/tests/lib/meta/typelist-diagnostics.hpp index 800af1a39..63ccda325 100644 --- a/tests/lib/meta/typelist-diagnostics.hpp +++ b/tests/lib/meta/typelist-diagnostics.hpp @@ -36,6 +36,7 @@ #define META_TYPELIST_DIAGNOSTICS_H +#include "lib/meta/typelist.hpp" #include "lib/meta/generator.hpp" #include @@ -68,9 +69,16 @@ namespace typelist{ struct Config; + + /** helper for generating test lists */ + template struct CountDown { typedef NullType List; }; + template<> struct CountDown > { typedef Node, NullType> List; }; + template struct CountDown > { typedef Node, typename CountDown >::List> List; }; - namespace test { - namespace { // hidden internals + + + namespace test { //< unit tests covering typelist manipulating templates + namespace { // hidden internals for diagnostics.... using boost::format; diff --git a/tests/lib/meta/typelist-manip-test.cpp b/tests/lib/meta/typelist-manip-test.cpp index a9f2ac06a..3f742ba6c 100644 --- a/tests/lib/meta/typelist-manip-test.cpp +++ b/tests/lib/meta/typelist-manip-test.cpp @@ -42,7 +42,7 @@ #include "lib/meta/generator.hpp" #include "lib/meta/typelistutil.hpp" #include "meta/typelist-diagnostics.hpp" -#include "lib/util.hpp" +//#include "lib/util.hpp" #include #include @@ -71,11 +71,7 @@ namespace test { >::List List2; - template struct CountDown { typedef NullType List; }; - template<> struct CountDown > { typedef Node, NullType> List; }; - template struct CountDown > { typedef Node, typename CountDown >::List> List; }; - - + // see also the CountDown template in typelist-diagnostics.hpp... } // (End) test data @@ -96,7 +92,8 @@ namespace test { */ class TypeListManipl_test : public Test { - virtual void run(Arg arg) + virtual void + run (Arg) { check_diagnostics (); check_apply (); @@ -108,7 +105,8 @@ namespace test { } - void check_diagnostics () + void + check_diagnostics () { // Explanation: the DISPLAY macro expands as follows.... typedef InstantiateChained Contents_List1; @@ -123,7 +121,8 @@ namespace test { } - void check_append () + void + check_append () { typedef Append Append1; DISPLAY (Append1); @@ -156,7 +155,8 @@ namespace test { template struct AddConst2 { typedef X Type; }; template struct AddConst2 > { typedef Num Type; }; - void check_apply () + void + check_apply () { typedef Apply Added2; DISPLAY (Added2); @@ -166,14 +166,16 @@ namespace test { template struct IsEven { enum {value = false }; }; template struct IsEven > { enum {value = (0 == I % 2) }; }; - void check_filter () + void + check_filter () { typedef Filter::List, IsEven > FilterEven; DISPLAY (FilterEven); } - void check_prefix () + void + check_prefix () { typedef PrefixAll,Num<22> > Prefix1; DISPLAY (Prefix1); @@ -196,7 +198,8 @@ namespace test { } - void check_distribute() + void + check_distribute() { typedef Distribute, List1> Dist1; DISPLAY (Dist1); @@ -213,7 +216,8 @@ namespace test { } - void check_combine() + void + check_combine() { typedef CountDown > Down; DISPLAY (Down);