LeechCraft
0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Toggle main menu visibility
Loading...
Searching...
No Matches
typegettertest.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 "
typegettertest.h
"
10
#include <type_traits>
11
#include <QtTest>
12
#include <
typegetter.h
>
13
14
QTEST_MAIN (
LC::Util::TypeGetterTest
)
15
16
namespace
LC
17
{
18
namespace
Util
19
{
20
namespace
21
{
22
template
<
typename
T>
23
void
PrintType ()
24
{
25
qDebug () << Q_FUNC_INFO;
26
}
27
}
28
29
void
TypeGetterTest::testArgType ()
30
{
31
const
auto
f
= [] (int,
const
double) {};
32
static_assert
(std::is_same_v<
ArgType_t
<
decltype
(
f
), 0>,
int
>);
33
static_assert
(std::is_same_v<
ArgType_t
<
decltype
(
f
), 1>,
double
>);
34
}
35
36
void
TypeGetterTest::testArgTypeRef ()
37
{
38
const
auto
f
= [] (
int
&,
const
double
&) {};
39
static_assert
(std::is_same_v<
ArgType_t
<
decltype
(
f
), 0>,
int
&>);
40
static_assert
(std::is_same_v<
ArgType_t
<
decltype
(
f
), 1>,
const
double
&>);
41
}
42
43
void
TypeGetterTest::testArgTypeRvalueRef ()
44
{
45
const
auto
f
= [] (
int
&&,
const
double
&&) {};
46
static_assert
(std::is_same_v<
ArgType_t
<
decltype
(
f
), 0>,
int
&&>);
47
static_assert
(std::is_same_v<
ArgType_t
<
decltype
(
f
), 1>,
const
double
&&>);
48
}
49
50
void
TypeGetterTest::testRetType ()
51
{
52
const
auto
f
= [] (
int
val,
const
double) {
return
val; };
53
static_assert
(std::is_same_v<
RetType_t
<
decltype
(
f
)>,
int
>);
54
}
55
56
void
TypeGetterTest::testRetTypeVoid ()
57
{
58
const
auto
f
= [] {};
59
static_assert
(std::is_same_v<
RetType_t
<
decltype
(
f
)>,
void
>);
60
}
61
62
void
TypeGetterTest::testRetTypeRef ()
63
{
64
int
x;
65
const
auto
f
= [&x] (int,
const
double) ->
int
& {
return
x; };
66
static_assert
(std::is_same_v<
RetType_t
<
decltype
(
f
)>,
int
&>);
67
}
68
69
void
TypeGetterTest::testRetTypeConstRef ()
70
{
71
int
x;
72
const
auto
f
= [&x] (int,
const
double) ->
const
int
& {
return
x; };
73
static_assert
(std::is_same_v<
RetType_t
<
decltype
(
f
)>,
const
int
&>);
74
}
75
76
void
TypeGetterTest::testArgCount ()
77
{
78
const
auto
f
= [] (int,
const
double) {};
79
static_assert
(
ArgCount_v
<
decltype
(
f
)> == 2);
80
}
81
}
82
}
LC::Util::TypeGetterTest
Definition
typegettertest.h:18
LC::Util::oral::sph::f
constexpr detail::ExprTree< detail::ExprType::LeafStaticPlaceholder, detail::MemberPtrs< Ptr > > f
Definition
oral.h:1083
LC::Util
Definition
icoreproxy.h:34
LC::Util::RetType_t
std::tuple_element_t< 0, detail::CallTypeGetter_t< F > > RetType_t
Definition
typegetter.h:52
LC::Util::ArgCount_v
constexpr auto ArgCount_v
Definition
typegetter.h:55
LC::Util::ArgType_t
std::tuple_element_t< Idx+1, detail::CallTypeGetter_t< F > > ArgType_t
Definition
typegetter.h:49
LC
Definition
constants.h:15
typegetter.h
typegettertest.h
src
util
sll
tests
typegettertest.cpp
Generated by
1.17.0