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
"
20
#include "
lib/meta/typelist-util.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
));
63
CHECK (
bool
(
IsInList<int64_t , TheList>::value
));
64
CHECK (
bool
(
IsInList<uint64_t, 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
test
Definition:
run.hpp:40
lib::meta::IsInList
Metafunction to check if a specific type is contained in a given typelist.
Definition:
typelist-util.hpp:108
typelist-util.hpp
Metaprogramming: simple helpers for working with lists-of-types.
lib
Implementation namespace for support and library code.
Definition:
common-services.cpp:54
lib::meta::maxSize
Metafunction " max( sizeof(T) ) for T in TYPES ".
Definition:
typelist-util.hpp:69
lib::meta::count
Metafunction counting the number of Types in the collection.
Definition:
typelist-util.hpp:52
run.hpp
Simplistic test class runner.
lib::meta::test::TypeListUtil_test
Definition:
typelist-util-test.cpp:50
library
meta
typelist-util-test.cpp
Generated on Fri Dec 13 2024 05:05:36 for Lumiera by
1.8.13