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)
5  2011, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 * *****************************************************************/
13 
19 #include "lib/test/run.hpp"
21 
22 
23 
24 namespace lib {
25 namespace meta {
26 namespace test {
27 
28 
29 
30  typedef Types< int
31  , uint
32  , int64_t
33  , uint64_t
34  >::List TheList;
35 
36  typedef Types< >::List EmptyList;
37 
38 
39 
40  /*********************************************************************/
50  class TypeListUtil_test : public Test
51  {
52  void
53  run (Arg)
54  {
55  CHECK (4 == count<TheList>::value);
56  CHECK (0 == count<EmptyList>::value);
57 
58  CHECK (sizeof(int64_t) == maxSize<TheList>::value);
59  CHECK (0 == maxSize<EmptyList>::value);
60 
61  CHECK ( bool(IsInList<int , TheList>::value));
62  CHECK ( bool(IsInList<uint , TheList>::value));
65 
66  CHECK (!bool(IsInList<double , TheList>::value));
67  CHECK (!bool(IsInList<int , EmptyList>::value));
68  CHECK (!bool(IsInList<int , int>::value)); // Note: not-a-typelist yields false too
69  }
70  };
71 
72 
74  LAUNCHER (TypeListUtil_test, "unit meta");
75 
76 
77 
78 }}} // namespace lib::meta::test
Definition: run.hpp:40
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.
Simplistic test class runner.