-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes_test.cpp
More file actions
65 lines (54 loc) · 2.57 KB
/
types_test.cpp
File metadata and controls
65 lines (54 loc) · 2.57 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "types.hpp"
#include <cstdlib>
int main(int argc, char* argv[]) {
// is_list
static_assert(types::is_list_v<types::list<>>);
static_assert(!types::is_list_v<int>);
// count
static_assert(types::count_v<types::list<>> == 0);
static_assert(types::count_v<types::list<int>> == 1);
static_assert(types::count_v<types::list<int, int>> == 2);
// push
static_assert(std::is_same_v<types::push_t<types::list<int>, int>,
types::list<int, int>>);
// extend
static_assert(std::is_same_v<
types::extend_t<types::list<int, int>, types::list<int, int>>,
types::list<int, int, int, int>>);
// reverse
static_assert(std::is_same_v<types::reverse_t<types::list<char, int>>,
types::list<int, char>>);
static_assert(std::is_same_v<types::reverse_t<types::list<char, int, double>>,
types::list<double, int, char>>);
// at
static_assert(std::is_same_v<types::at_t<types::list<int, double>, 0>, int>);
static_assert(
std::is_same_v<types::at_t<types::list<int, double>, 1>, double>);
// filter
static_assert(std::is_same_v<
types::filter_t<types::list<int, const int>, std::is_const>,
types::list<const int>>);
// transform
static_assert(std::is_same_v<types::transform_t<types::list<int, const int>,
std::remove_const>,
types::list<int, int>>);
// prefix
static_assert(std::is_same_v<types::prefix_t<types::list<int, double>, 0>,
types::list<>>);
static_assert(std::is_same_v<types::prefix_t<types::list<int, double>, 1>,
types::list<int>>);
static_assert(std::is_same_v<types::prefix_t<types::list<int, double>, 2>,
types::list<int, double>>);
static_assert(std::is_same_v<types::prefix_t<types::list<int, double>, 3>,
types::list<int, double>>);
// suffix
static_assert(std::is_same_v<types::suffix_t<types::list<int, double>, 0>,
types::list<>>);
static_assert(std::is_same_v<types::suffix_t<types::list<int, double>, 1>,
types::list<double>>);
static_assert(std::is_same_v<types::suffix_t<types::list<int, double>, 2>,
types::list<int, double>>);
static_assert(std::is_same_v<types::suffix_t<types::list<int, double>, 3>,
types::list<int, double>>);
return EXIT_SUCCESS;
}