LeechCraft 0.6.70-17609-g3dde4097dd
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
typelisttest.cpp
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#include "typelisttest.h"
10#include <QtTest>
11#include <typelist.h>
12#include <typelevel.h>
13
14QTEST_MAIN (LC::Util::TypelistTest)
15
16namespace LC
17{
18namespace Util
19{
20 void TypelistTest::testHasTypeTrue ()
21 {
22 static_assert (HasType<struct Foo> (Typelist<struct Bar, struct Baz, struct Foo> {}), "test failed");
23 }
24
25 void TypelistTest::testHasTypeFalse ()
26 {
27 static_assert (!HasType<struct Foo> (Typelist<struct Bar, struct Baz, struct Qux> {}), "test failed");
28 }
29
30 template<typename T>
31 using IsVoid_t = std::is_same<T, void>;
32
33 void TypelistTest::testFilter ()
34 {
37 using Removed_t = Typelist<void, void, void>;
38
39 static_assert (std::is_same<Removed_t, Filter_t<IsVoid_t, List_t>>::value, "test failed");
40 static_assert (std::is_same<Expected_t, Filter_t<Not<IsVoid_t>::Result_t, List_t>>::value, "test failed");
41 }
42}
43}
constexpr bool HasType(List< Args... >)
Definition typelist.h:95
std::is_same< T, void > IsVoid_t
Definition constants.h:15