Lumiera
0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
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
using
TheList
=
Types
<
int
31
,
uint
32
,
int64_t
33
,
uint64_t
34
>::List;
35
36
using
EmptyList
=
Types< >::List
;
37
38
39
40
/*********************************************************************/
50
class
TypeListUtil_test
:
public
Test
51
{
52
void
53
run
(Arg)
54
{
55
CHECK
(4 ==
count<TheList>
() );
56
CHECK
(0 ==
count<EmptyList>
());
57
58
CHECK
(
sizeof
(
int64_t
) ==
maxSize<TheList>
() );
59
CHECK
(0 ==
maxSize<EmptyList>
() );
60
CHECK
(
alignof
(
int64_t
) ==
maxAlign<TheList>
() );
61
CHECK
(0 ==
maxAlign<EmptyList>
());
62
63
CHECK
(
bool
(
isInList<int , TheList>
()));
64
CHECK
(
bool
(
isInList<uint , TheList>
()));
65
CHECK
(
bool
(
isInList<int64_t , TheList>
()));
66
CHECK
(
bool
(
isInList<uint64_t, TheList>
()));
67
68
CHECK
(!
bool
(
isInList<double , TheList>
()));
69
CHECK
(!
bool
(
isInList<int , EmptyList>
()));
70
CHECK
(!
bool
(
isInList<int , int>
()));
// Note: not-a-typelist yields false too
71
}
72
};
73
74
76
LAUNCHER
(
TypeListUtil_test
,
"unit meta"
);
77
78
79
80
}}}
// namespace lib::meta::test
lib::meta::test::TypeListUtil_test
Definition
typelist-util-test.cpp:51
lib::meta::test::TypeListUtil_test::run
void run(Arg)
Definition
typelist-util-test.cpp:53
uint
unsigned int uint
Definition
integral.hpp:29
lib::meta::test::TheList
Types< int, uint, int64_t, uint64_t >::List TheList
Definition
typelist-util-test.cpp:34
lib::meta::test::EmptyList
Types< >::List EmptyList
Definition
typelist-util-test.cpp:36
lib::meta::enable_if
enable_if_c< Cond::value, T >::type enable_if
SFINAE helper to control the visibility of specialisations and overloads.
Definition
meta/util.hpp:87
lib::meta::Types
variadic sequence of types
Definition
typelist.hpp:102
lib
Implementation namespace for support and library code.
Definition
common-services.cpp:55
test
Test runner and basic definitions for tests.
run.hpp
Simplistic test class runner.
LAUNCHER
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Definition
run.hpp:116
typelist-util.hpp
Metaprogramming: simple helpers for working with lists-of-types.
library
meta
typelist-util-test.cpp
Generated on Fri Nov 7 2025 for Lumiera by
1.9.8