-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda_tuple_unittest.cpp
More file actions
35 lines (28 loc) · 866 Bytes
/
lambda_tuple_unittest.cpp
File metadata and controls
35 lines (28 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* @file lambda_tuple_unittest.cpp
* @author Xuhua Huang
* @brief
* @version 0.1
* @date 2023-06-18
*
* g++ -c lambda_tuple_unittest.cpp -o lambda_tuple_unittest.exe -std=c++2b -Wall -Wextra
*
* @copyright Copyright (c) 2023
*
*/
#include "lambda_tuple.hpp"
#include <iostream>
int main() {
using util::type::get;
using util::type::tuple;
static_assert(1 == get<0>(tuple(1, 2, 3)));
static_assert(2 == get<1>(tuple(1, 2, 3)));
static_assert(3 == get<2>(tuple(1, 2, 3)));
static_assert('a' == get<0>(tuple('a', 42, 77.)));
static_assert(42 == get<1>(tuple('a', 42, 77.)));
static_assert(77. == get<2>(tuple('a', 42, 77.)));
static_assert(42 == get<int>(tuple('a', 42, 77.)));
static_assert(77. == get<double>(tuple('a', 42, 77.)));
static_assert('a' == get<char>(tuple('a', 42, 77.)));
return 0;
}