LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
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 
14 QTEST_MAIN (LC::Util::TypelistTest)
15 
16 namespace LC
17 {
18 namespace 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  {
35  using List_t = Typelist<struct Foo, struct Bar, void, void, int, double, void>;
36  using Expected_t = Typelist<struct Foo, struct Bar, int, double>;
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 }
typelist.h
LC::Util::IsVoid_t
std::is_same< T, void > IsVoid_t
Definition: typelisttest.cpp:43
typelisttest.h
typelevel.h
LC
Definition: constants.h:14
LC::Util::TypelistTest
Definition: typelisttest.h:29