You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

356 lines
18 KiB

  1. // This file is part of Eigen, a lightweight C++ template library
  2. // for linear algebra.
  3. //
  4. // Copyright (C) 2013 Christian Seiler <christian@iwakd.de>
  5. //
  6. // This Source Code Form is subject to the terms of the Mozilla
  7. // Public License v. 2.0. If a copy of the MPL was not distributed
  8. // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
  9. #include "main.h"
  10. #include <StormEigen/CXX11/Core>
  11. using StormEigen::internal::is_same;
  12. using StormEigen::internal::type_list;
  13. using StormEigen::internal::numeric_list;
  14. using StormEigen::internal::gen_numeric_list;
  15. using StormEigen::internal::gen_numeric_list_reversed;
  16. using StormEigen::internal::gen_numeric_list_swapped_pair;
  17. using StormEigen::internal::gen_numeric_list_repeated;
  18. using StormEigen::internal::concat;
  19. using StormEigen::internal::mconcat;
  20. using StormEigen::internal::take;
  21. using StormEigen::internal::skip;
  22. using StormEigen::internal::slice;
  23. using StormEigen::internal::get;
  24. using StormEigen::internal::id_numeric;
  25. using StormEigen::internal::id_type;
  26. using StormEigen::internal::is_same_gf;
  27. using StormEigen::internal::apply_op_from_left;
  28. using StormEigen::internal::apply_op_from_right;
  29. using StormEigen::internal::contained_in_list;
  30. using StormEigen::internal::contained_in_list_gf;
  31. using StormEigen::internal::arg_prod;
  32. using StormEigen::internal::arg_sum;
  33. using StormEigen::internal::sum_op;
  34. using StormEigen::internal::product_op;
  35. using StormEigen::internal::array_reverse;
  36. using StormEigen::internal::array_sum;
  37. using StormEigen::internal::array_prod;
  38. using StormEigen::internal::array_reduce;
  39. using StormEigen::internal::array_zip;
  40. using StormEigen::internal::array_zip_and_reduce;
  41. using StormEigen::internal::array_apply;
  42. using StormEigen::internal::array_apply_and_reduce;
  43. using StormEigen::internal::repeat;
  44. using StormEigen::internal::instantiate_by_c_array;
  45. struct dummy_a {};
  46. struct dummy_b {};
  47. struct dummy_c {};
  48. struct dummy_d {};
  49. struct dummy_e {};
  50. // dummy operation for testing apply
  51. template<typename A, typename B> struct dummy_op;
  52. template<> struct dummy_op<dummy_a, dummy_b> { typedef dummy_c type; };
  53. template<> struct dummy_op<dummy_b, dummy_a> { typedef dummy_d type; };
  54. template<> struct dummy_op<dummy_b, dummy_c> { typedef dummy_a type; };
  55. template<> struct dummy_op<dummy_c, dummy_b> { typedef dummy_d type; };
  56. template<> struct dummy_op<dummy_c, dummy_a> { typedef dummy_b type; };
  57. template<> struct dummy_op<dummy_a, dummy_c> { typedef dummy_d type; };
  58. template<> struct dummy_op<dummy_a, dummy_a> { typedef dummy_e type; };
  59. template<> struct dummy_op<dummy_b, dummy_b> { typedef dummy_e type; };
  60. template<> struct dummy_op<dummy_c, dummy_c> { typedef dummy_e type; };
  61. template<typename A, typename B> struct dummy_test { constexpr static bool value = false; constexpr static int global_flags = 0; };
  62. template<> struct dummy_test<dummy_a, dummy_a> { constexpr static bool value = true; constexpr static int global_flags = 1; };
  63. template<> struct dummy_test<dummy_b, dummy_b> { constexpr static bool value = true; constexpr static int global_flags = 2; };
  64. template<> struct dummy_test<dummy_c, dummy_c> { constexpr static bool value = true; constexpr static int global_flags = 4; };
  65. struct times2_op { template<typename A> static A run(A v) { return v * 2; } };
  66. struct dummy_inst
  67. {
  68. int c;
  69. dummy_inst() : c(0) {}
  70. explicit dummy_inst(int) : c(1) {}
  71. dummy_inst(int, int) : c(2) {}
  72. dummy_inst(int, int, int) : c(3) {}
  73. dummy_inst(int, int, int, int) : c(4) {}
  74. dummy_inst(int, int, int, int, int) : c(5) {}
  75. };
  76. static void test_gen_numeric_list()
  77. {
  78. VERIFY((is_same<typename gen_numeric_list<int, 0>::type, numeric_list<int>>::value));
  79. VERIFY((is_same<typename gen_numeric_list<int, 1>::type, numeric_list<int, 0>>::value));
  80. VERIFY((is_same<typename gen_numeric_list<int, 2>::type, numeric_list<int, 0, 1>>::value));
  81. VERIFY((is_same<typename gen_numeric_list<int, 5>::type, numeric_list<int, 0, 1, 2, 3, 4>>::value));
  82. VERIFY((is_same<typename gen_numeric_list<int, 10>::type, numeric_list<int, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9>>::value));
  83. VERIFY((is_same<typename gen_numeric_list<int, 0, 42>::type, numeric_list<int>>::value));
  84. VERIFY((is_same<typename gen_numeric_list<int, 1, 42>::type, numeric_list<int, 42>>::value));
  85. VERIFY((is_same<typename gen_numeric_list<int, 2, 42>::type, numeric_list<int, 42, 43>>::value));
  86. VERIFY((is_same<typename gen_numeric_list<int, 5, 42>::type, numeric_list<int, 42, 43, 44, 45, 46>>::value));
  87. VERIFY((is_same<typename gen_numeric_list<int, 10, 42>::type, numeric_list<int, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51>>::value));
  88. VERIFY((is_same<typename gen_numeric_list_reversed<int, 0>::type, numeric_list<int>>::value));
  89. VERIFY((is_same<typename gen_numeric_list_reversed<int, 1>::type, numeric_list<int, 0>>::value));
  90. VERIFY((is_same<typename gen_numeric_list_reversed<int, 2>::type, numeric_list<int, 1, 0>>::value));
  91. VERIFY((is_same<typename gen_numeric_list_reversed<int, 5>::type, numeric_list<int, 4, 3, 2, 1, 0>>::value));
  92. VERIFY((is_same<typename gen_numeric_list_reversed<int, 10>::type, numeric_list<int, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0>>::value));
  93. VERIFY((is_same<typename gen_numeric_list_reversed<int, 0, 42>::type, numeric_list<int>>::value));
  94. VERIFY((is_same<typename gen_numeric_list_reversed<int, 1, 42>::type, numeric_list<int, 42>>::value));
  95. VERIFY((is_same<typename gen_numeric_list_reversed<int, 2, 42>::type, numeric_list<int, 43, 42>>::value));
  96. VERIFY((is_same<typename gen_numeric_list_reversed<int, 5, 42>::type, numeric_list<int, 46, 45, 44, 43, 42>>::value));
  97. VERIFY((is_same<typename gen_numeric_list_reversed<int, 10, 42>::type, numeric_list<int, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42>>::value));
  98. VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 0, 2, 3>::type, numeric_list<int>>::value));
  99. VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 1, 2, 3>::type, numeric_list<int, 0>>::value));
  100. VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 2, 2, 3>::type, numeric_list<int, 0, 1>>::value));
  101. VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 5, 2, 3>::type, numeric_list<int, 0, 1, 3, 2, 4>>::value));
  102. VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 10, 2, 3>::type, numeric_list<int, 0, 1, 3, 2, 4, 5, 6, 7, 8, 9>>::value));
  103. VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 0, 44, 45, 42>::type, numeric_list<int>>::value));
  104. VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 1, 44, 45, 42>::type, numeric_list<int, 42>>::value));
  105. VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 2, 44, 45, 42>::type, numeric_list<int, 42, 43>>::value));
  106. VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 5, 44, 45, 42>::type, numeric_list<int, 42, 43, 45, 44, 46>>::value));
  107. VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 10, 44, 45, 42>::type, numeric_list<int, 42, 43, 45, 44, 46, 47, 48, 49, 50, 51>>::value));
  108. VERIFY((is_same<typename gen_numeric_list_repeated<int, 0, 0>::type, numeric_list<int>>::value));
  109. VERIFY((is_same<typename gen_numeric_list_repeated<int, 1, 0>::type, numeric_list<int, 0>>::value));
  110. VERIFY((is_same<typename gen_numeric_list_repeated<int, 2, 0>::type, numeric_list<int, 0, 0>>::value));
  111. VERIFY((is_same<typename gen_numeric_list_repeated<int, 5, 0>::type, numeric_list<int, 0, 0, 0, 0, 0>>::value));
  112. VERIFY((is_same<typename gen_numeric_list_repeated<int, 10, 0>::type, numeric_list<int, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>>::value));
  113. }
  114. static void test_concat()
  115. {
  116. VERIFY((is_same<typename concat<type_list<dummy_a, dummy_a>, type_list<>>::type, type_list<dummy_a, dummy_a>>::value));
  117. VERIFY((is_same<typename concat<type_list<>, type_list<dummy_a, dummy_a>>::type, type_list<dummy_a, dummy_a>>::value));
  118. VERIFY((is_same<typename concat<type_list<dummy_a, dummy_a>, type_list<dummy_a, dummy_a>>::type, type_list<dummy_a, dummy_a, dummy_a, dummy_a>>::value));
  119. VERIFY((is_same<typename concat<type_list<dummy_a, dummy_a>, type_list<dummy_b, dummy_c>>::type, type_list<dummy_a, dummy_a, dummy_b, dummy_c>>::value));
  120. VERIFY((is_same<typename concat<type_list<dummy_a>, type_list<dummy_b, dummy_c>>::type, type_list<dummy_a, dummy_b, dummy_c>>::value));
  121. VERIFY((is_same<typename concat<numeric_list<int, 0, 0>, numeric_list<int>>::type, numeric_list<int, 0, 0>>::value));
  122. VERIFY((is_same<typename concat<numeric_list<int>, numeric_list<int, 0, 0>>::type, numeric_list<int, 0, 0>>::value));
  123. VERIFY((is_same<typename concat<numeric_list<int, 0, 0>, numeric_list<int, 0, 0>>::type, numeric_list<int, 0, 0, 0, 0>>::value));
  124. VERIFY((is_same<typename concat<numeric_list<int, 0, 0>, numeric_list<int, 1, 2>>::type, numeric_list<int, 0, 0, 1, 2>>::value));
  125. VERIFY((is_same<typename concat<numeric_list<int, 0>, numeric_list<int, 1, 2>>::type, numeric_list<int, 0, 1, 2>>::value));
  126. VERIFY((is_same<typename mconcat<type_list<dummy_a>>::type, type_list<dummy_a>>::value));
  127. VERIFY((is_same<typename mconcat<type_list<dummy_a>, type_list<dummy_b>>::type, type_list<dummy_a, dummy_b>>::value));
  128. VERIFY((is_same<typename mconcat<type_list<dummy_a>, type_list<dummy_b>, type_list<dummy_c>>::type, type_list<dummy_a, dummy_b, dummy_c>>::value));
  129. VERIFY((is_same<typename mconcat<type_list<dummy_a>, type_list<dummy_b, dummy_c>>::type, type_list<dummy_a, dummy_b, dummy_c>>::value));
  130. VERIFY((is_same<typename mconcat<type_list<dummy_a, dummy_b>, type_list<dummy_c>>::type, type_list<dummy_a, dummy_b, dummy_c>>::value));
  131. VERIFY((is_same<typename mconcat<numeric_list<int, 0>>::type, numeric_list<int, 0>>::value));
  132. VERIFY((is_same<typename mconcat<numeric_list<int, 0>, numeric_list<int, 1>>::type, numeric_list<int, 0, 1>>::value));
  133. VERIFY((is_same<typename mconcat<numeric_list<int, 0>, numeric_list<int, 1>, numeric_list<int, 2>>::type, numeric_list<int, 0, 1, 2>>::value));
  134. VERIFY((is_same<typename mconcat<numeric_list<int, 0>, numeric_list<int, 1, 2>>::type, numeric_list<int, 0, 1, 2>>::value));
  135. VERIFY((is_same<typename mconcat<numeric_list<int, 0, 1>, numeric_list<int, 2>>::type, numeric_list<int, 0, 1, 2>>::value));
  136. }
  137. static void test_slice()
  138. {
  139. typedef type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c, dummy_c> tl;
  140. typedef numeric_list<int, 0, 1, 2, 3, 4, 5> il;
  141. VERIFY((is_same<typename take<0, tl>::type, type_list<>>::value));
  142. VERIFY((is_same<typename take<1, tl>::type, type_list<dummy_a>>::value));
  143. VERIFY((is_same<typename take<2, tl>::type, type_list<dummy_a, dummy_a>>::value));
  144. VERIFY((is_same<typename take<3, tl>::type, type_list<dummy_a, dummy_a, dummy_b>>::value));
  145. VERIFY((is_same<typename take<4, tl>::type, type_list<dummy_a, dummy_a, dummy_b, dummy_b>>::value));
  146. VERIFY((is_same<typename take<5, tl>::type, type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c>>::value));
  147. VERIFY((is_same<typename take<6, tl>::type, type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c, dummy_c>>::value));
  148. VERIFY((is_same<typename take<0, il>::type, numeric_list<int>>::value));
  149. VERIFY((is_same<typename take<1, il>::type, numeric_list<int, 0>>::value));
  150. VERIFY((is_same<typename take<2, il>::type, numeric_list<int, 0, 1>>::value));
  151. VERIFY((is_same<typename take<3, il>::type, numeric_list<int, 0, 1, 2>>::value));
  152. VERIFY((is_same<typename take<4, il>::type, numeric_list<int, 0, 1, 2, 3>>::value));
  153. VERIFY((is_same<typename take<5, il>::type, numeric_list<int, 0, 1, 2, 3, 4>>::value));
  154. VERIFY((is_same<typename take<6, il>::type, numeric_list<int, 0, 1, 2, 3, 4, 5>>::value));
  155. VERIFY((is_same<typename skip<0, tl>::type, type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c, dummy_c>>::value));
  156. VERIFY((is_same<typename skip<1, tl>::type, type_list<dummy_a, dummy_b, dummy_b, dummy_c, dummy_c>>::value));
  157. VERIFY((is_same<typename skip<2, tl>::type, type_list<dummy_b, dummy_b, dummy_c, dummy_c>>::value));
  158. VERIFY((is_same<typename skip<3, tl>::type, type_list<dummy_b, dummy_c, dummy_c>>::value));
  159. VERIFY((is_same<typename skip<4, tl>::type, type_list<dummy_c, dummy_c>>::value));
  160. VERIFY((is_same<typename skip<5, tl>::type, type_list<dummy_c>>::value));
  161. VERIFY((is_same<typename skip<6, tl>::type, type_list<>>::value));
  162. VERIFY((is_same<typename skip<0, il>::type, numeric_list<int, 0, 1, 2, 3, 4, 5>>::value));
  163. VERIFY((is_same<typename skip<1, il>::type, numeric_list<int, 1, 2, 3, 4, 5>>::value));
  164. VERIFY((is_same<typename skip<2, il>::type, numeric_list<int, 2, 3, 4, 5>>::value));
  165. VERIFY((is_same<typename skip<3, il>::type, numeric_list<int, 3, 4, 5>>::value));
  166. VERIFY((is_same<typename skip<4, il>::type, numeric_list<int, 4, 5>>::value));
  167. VERIFY((is_same<typename skip<5, il>::type, numeric_list<int, 5>>::value));
  168. VERIFY((is_same<typename skip<6, il>::type, numeric_list<int>>::value));
  169. VERIFY((is_same<typename slice<0, 3, tl>::type, typename take<3, tl>::type>::value));
  170. VERIFY((is_same<typename slice<0, 3, il>::type, typename take<3, il>::type>::value));
  171. VERIFY((is_same<typename slice<1, 3, tl>::type, type_list<dummy_a, dummy_b, dummy_b>>::value));
  172. VERIFY((is_same<typename slice<1, 3, il>::type, numeric_list<int, 1, 2, 3>>::value));
  173. }
  174. static void test_get()
  175. {
  176. typedef type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c, dummy_c> tl;
  177. typedef numeric_list<int, 4, 8, 15, 16, 23, 42> il;
  178. VERIFY((is_same<typename get<0, tl>::type, dummy_a>::value));
  179. VERIFY((is_same<typename get<1, tl>::type, dummy_a>::value));
  180. VERIFY((is_same<typename get<2, tl>::type, dummy_b>::value));
  181. VERIFY((is_same<typename get<3, tl>::type, dummy_b>::value));
  182. VERIFY((is_same<typename get<4, tl>::type, dummy_c>::value));
  183. VERIFY((is_same<typename get<5, tl>::type, dummy_c>::value));
  184. VERIFY_IS_EQUAL(((int)get<0, il>::value), 4);
  185. VERIFY_IS_EQUAL(((int)get<1, il>::value), 8);
  186. VERIFY_IS_EQUAL(((int)get<2, il>::value), 15);
  187. VERIFY_IS_EQUAL(((int)get<3, il>::value), 16);
  188. VERIFY_IS_EQUAL(((int)get<4, il>::value), 23);
  189. VERIFY_IS_EQUAL(((int)get<5, il>::value), 42);
  190. }
  191. static void test_id_helper(dummy_a a, dummy_a b, dummy_a c)
  192. {
  193. (void)a;
  194. (void)b;
  195. (void)c;
  196. }
  197. template<int... ii>
  198. static void test_id_numeric()
  199. {
  200. test_id_helper(typename id_numeric<int, ii, dummy_a>::type()...);
  201. }
  202. template<typename... tt>
  203. static void test_id_type()
  204. {
  205. test_id_helper(typename id_type<tt, dummy_a>::type()...);
  206. }
  207. static void test_id()
  208. {
  209. // don't call VERIFY here, just assume it works if it compiles
  210. // (otherwise it will complain that it can't find the function)
  211. test_id_numeric<1, 4, 6>();
  212. test_id_type<dummy_a, dummy_b, dummy_c>();
  213. }
  214. static void test_is_same_gf()
  215. {
  216. VERIFY((!is_same_gf<dummy_a, dummy_b>::value));
  217. VERIFY((!!is_same_gf<dummy_a, dummy_a>::value));
  218. VERIFY_IS_EQUAL((!!is_same_gf<dummy_a, dummy_b>::global_flags), 0);
  219. VERIFY_IS_EQUAL((!!is_same_gf<dummy_a, dummy_a>::global_flags), 0);
  220. }
  221. static void test_apply_op()
  222. {
  223. typedef type_list<dummy_a, dummy_b, dummy_c> tl;
  224. VERIFY((!!is_same<typename apply_op_from_left<dummy_op, dummy_a, tl>::type, type_list<dummy_e, dummy_c, dummy_d>>::value));
  225. VERIFY((!!is_same<typename apply_op_from_right<dummy_op, dummy_a, tl>::type, type_list<dummy_e, dummy_d, dummy_b>>::value));
  226. }
  227. static void test_contained_in_list()
  228. {
  229. typedef type_list<dummy_a, dummy_b, dummy_c> tl;
  230. VERIFY((!!contained_in_list<is_same, dummy_a, tl>::value));
  231. VERIFY((!!contained_in_list<is_same, dummy_b, tl>::value));
  232. VERIFY((!!contained_in_list<is_same, dummy_c, tl>::value));
  233. VERIFY((!contained_in_list<is_same, dummy_d, tl>::value));
  234. VERIFY((!contained_in_list<is_same, dummy_e, tl>::value));
  235. VERIFY((!!contained_in_list_gf<dummy_test, dummy_a, tl>::value));
  236. VERIFY((!!contained_in_list_gf<dummy_test, dummy_b, tl>::value));
  237. VERIFY((!!contained_in_list_gf<dummy_test, dummy_c, tl>::value));
  238. VERIFY((!contained_in_list_gf<dummy_test, dummy_d, tl>::value));
  239. VERIFY((!contained_in_list_gf<dummy_test, dummy_e, tl>::value));
  240. VERIFY_IS_EQUAL(((int)contained_in_list_gf<dummy_test, dummy_a, tl>::global_flags), 1);
  241. VERIFY_IS_EQUAL(((int)contained_in_list_gf<dummy_test, dummy_b, tl>::global_flags), 2);
  242. VERIFY_IS_EQUAL(((int)contained_in_list_gf<dummy_test, dummy_c, tl>::global_flags), 4);
  243. VERIFY_IS_EQUAL(((int)contained_in_list_gf<dummy_test, dummy_d, tl>::global_flags), 0);
  244. VERIFY_IS_EQUAL(((int)contained_in_list_gf<dummy_test, dummy_e, tl>::global_flags), 0);
  245. }
  246. static void test_arg_reductions()
  247. {
  248. VERIFY_IS_EQUAL(arg_sum(1,2,3,4), 10);
  249. VERIFY_IS_EQUAL(arg_prod(1,2,3,4), 24);
  250. VERIFY_IS_APPROX(arg_sum(0.5, 2, 5), 7.5);
  251. VERIFY_IS_APPROX(arg_prod(0.5, 2, 5), 5.0);
  252. }
  253. static void test_array_reverse_and_reduce()
  254. {
  255. std::array<int, 6> a{{4, 8, 15, 16, 23, 42}};
  256. std::array<int, 6> b{{42, 23, 16, 15, 8, 4}};
  257. // there is no operator<< for std::array, so VERIFY_IS_EQUAL will
  258. // not compile
  259. VERIFY((array_reverse(a) == b));
  260. VERIFY((array_reverse(b) == a));
  261. VERIFY_IS_EQUAL((array_sum(a)), 108);
  262. VERIFY_IS_EQUAL((array_sum(b)), 108);
  263. VERIFY_IS_EQUAL((array_prod(a)), 7418880);
  264. VERIFY_IS_EQUAL((array_prod(b)), 7418880);
  265. }
  266. static void test_array_zip_and_apply()
  267. {
  268. std::array<int, 6> a{{4, 8, 15, 16, 23, 42}};
  269. std::array<int, 6> b{{0, 1, 2, 3, 4, 5}};
  270. std::array<int, 6> c{{4, 9, 17, 19, 27, 47}};
  271. std::array<int, 6> d{{0, 8, 30, 48, 92, 210}};
  272. std::array<int, 6> e{{0, 2, 4, 6, 8, 10}};
  273. VERIFY((array_zip<sum_op>(a, b) == c));
  274. VERIFY((array_zip<product_op>(a, b) == d));
  275. VERIFY((array_apply<times2_op>(b) == e));
  276. VERIFY_IS_EQUAL((array_apply_and_reduce<sum_op, times2_op>(a)), 216);
  277. VERIFY_IS_EQUAL((array_apply_and_reduce<sum_op, times2_op>(b)), 30);
  278. VERIFY_IS_EQUAL((array_zip_and_reduce<product_op, sum_op>(a, b)), 14755932);
  279. VERIFY_IS_EQUAL((array_zip_and_reduce<sum_op, product_op>(a, b)), 388);
  280. }
  281. static void test_array_misc()
  282. {
  283. std::array<int, 3> a3{{1, 1, 1}};
  284. std::array<int, 6> a6{{2, 2, 2, 2, 2, 2}};
  285. VERIFY((repeat<3, int>(1) == a3));
  286. VERIFY((repeat<6, int>(2) == a6));
  287. int data[5] = { 0, 1, 2, 3, 4 };
  288. VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 0>(data).c), 0);
  289. VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 1>(data).c), 1);
  290. VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 2>(data).c), 2);
  291. VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 3>(data).c), 3);
  292. VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 4>(data).c), 4);
  293. VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 5>(data).c), 5);
  294. }
  295. void test_cxx11_meta()
  296. {
  297. CALL_SUBTEST(test_gen_numeric_list());
  298. CALL_SUBTEST(test_concat());
  299. CALL_SUBTEST(test_slice());
  300. CALL_SUBTEST(test_get());
  301. CALL_SUBTEST(test_id());
  302. CALL_SUBTEST(test_is_same_gf());
  303. CALL_SUBTEST(test_apply_op());
  304. CALL_SUBTEST(test_contained_in_list());
  305. CALL_SUBTEST(test_arg_reductions());
  306. CALL_SUBTEST(test_array_reverse_and_reduce());
  307. CALL_SUBTEST(test_array_zip_and_apply());
  308. CALL_SUBTEST(test_array_misc());
  309. }