Lumiera  0.pre.03
»edit your freedom«
typelist-util-test.cpp
Go to the documentation of this file.
1 /*
2  TypeListUtil(Test) - check the simple typelist metaprogramming helpers
3 
4  Copyright (C) Lumiera.org
5  2011, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
28 #include "lib/test/run.hpp"
30 
31 
32 
33 namespace lib {
34 namespace meta {
35 namespace test {
36 
37 
38 
39  typedef Types< int
40  , uint
41  , int64_t
42  , uint64_t
43  >::List TheList;
44 
45  typedef Types< >::List EmptyList;
46 
47 
48 
49  /*********************************************************************/
59  class TypeListUtil_test : public Test
60  {
61  void
62  run (Arg)
63  {
64  CHECK (4 == count<TheList>::value);
65  CHECK (0 == count<EmptyList>::value);
66 
67  CHECK (sizeof(int64_t) == maxSize<TheList>::value);
68  CHECK (0 == maxSize<EmptyList>::value);
69 
70  CHECK ( bool(IsInList<int , TheList>::value));
71  CHECK ( bool(IsInList<uint , TheList>::value));
74 
75  CHECK (!bool(IsInList<double , TheList>::value));
76  CHECK (!bool(IsInList<int , EmptyList>::value));
77  CHECK (!bool(IsInList<int , int>::value)); // Note: not-a-typelist yields false too
78  }
79  };
80 
81 
83  LAUNCHER (TypeListUtil_test, "unit meta");
84 
85 
86 
87 }}} // namespace lib::meta::test
Definition: run.hpp:49
Metafunction to check if a specific type is contained in a given typelist.
Metaprogramming: simple helpers for working with lists-of-types.
Implementation namespace for support and library code.
Metafunction " max( sizeof(T) ) for T in TYPES ".
Metafunction counting the number of Types in the collection.
Simple test class runner.