SpiecsEngine
 
Loading...
Searching...
No Matches

◆ TEST() [56/59]

SpicesTest::TEST ( TypeListTest_test ,
TypeList  )

Testing Spices::TypeList.

Definition at line 35 of file TypeList_test.h.

35 {
36
38
39 using TypeList = Spices::type_list<int, float, std::string, void*, void(*)(int)>;
40
41 {
42 constexpr bool v = std::is_same_v<Spices::head<TypeList>, int>;
43
44 EXPECT_EQ(v, true);
45 }
46
47 {
48 constexpr bool v = std::is_same_v<Spices::tail<TypeList>, Spices::type_list<float, std::string, void*, void(*)(int)>>;
49
50 EXPECT_EQ(v, true);
51 }
52
53 {
54 constexpr bool v0 = std::is_same_v<Spices::nth<TypeList, 0>, int>;
55 constexpr bool v1 = std::is_same_v<Spices::nth<TypeList, 1>, float>;
56 constexpr bool v2 = std::is_same_v<Spices::nth<TypeList, 2>, std::string>;
57 constexpr bool v3 = std::is_same_v<Spices::nth<TypeList, 3>, void*>;
58 constexpr bool v4 = std::is_same_v<Spices::nth<TypeList, 4>, void(*)(int)>;
59
60 EXPECT_EQ(v0, true);
61 EXPECT_EQ(v1, true);
62 EXPECT_EQ(v2, true);
63 EXPECT_EQ(v3, true);
64 EXPECT_EQ(v4, true);
65 }
66
67 {
68 constexpr int v = Spices::count<TypeList, is_intergral>;
69
70 EXPECT_EQ(v, 1);
71 }
72
73 {
74 constexpr bool v = std::is_same_v<Spices::map<TypeList, change_int_to_float>, Spices::type_list<float, float, std::string, void*, void(*)(int)>>;
75
76 EXPECT_EQ(v, true);
77 }
78
79 {
80 constexpr bool v = std::is_same_v<Spices::cons<char, TypeList>, Spices::type_list<char, int, float, std::string, void*, void(*)(int)>>;
81
82 EXPECT_EQ(v, true);
83 }
84
85 {
86 using TypeList1 = Spices::type_list<char*, float>;
87 constexpr bool v = std::is_same_v<Spices::concat<TypeList, TypeList1>, Spices::type_list<int, float, std::string, void*, void(*)(int), char*, float>>;
88
89 EXPECT_EQ(v, true);
90 }
91
92 {
93 constexpr bool v = std::is_same_v<Spices::init<TypeList>, Spices::type_list<int, float, std::string, void*>>;
94
95 EXPECT_EQ(v, true);
96 }
97
98 {
99 constexpr bool v = std::is_same_v<Spices::filter<TypeList, is_not_float>, Spices::type_list<int, std::string, void*, void(*)(int)>>;
100
101 EXPECT_EQ(v, true);
102 }
103 }
#define SPICESTEST_PROFILE_FUNCTION()
Container of store Types.
Definition TypeList.h:20