8#ifndef SRC_UTIL_VARIADIC_TO_VMPL_UNIT_TEST_HPP_
9#define SRC_UTIL_VARIADIC_TO_VMPL_UNIT_TEST_HPP_
11#include "util/variadic_to_vmpl.hpp"
12#include "util/util_debug.hpp"
25template <
typename arg0,
typename T>
33BOOST_AUTO_TEST_CASE( variadic_to_vmpl_test)
38 typedef boost::mpl::vector<float,float,float[3]> bfv;
43 bool val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<0>>::type,
aggregate<float>>::value;
44 BOOST_REQUIRE_EQUAL(val,
true);
46 val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<1>>::type,
aggregate<float>>::value;
47 BOOST_REQUIRE_EQUAL(val,
true);
49 val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<2>>::type,
aggregate<float[3]>>::value;
50 BOOST_REQUIRE_EQUAL(val,
true);
58 typedef boost::mpl::vector<float,float,float[3]> bfv;
63 bool val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<0>>::type,
aggregate<float>>::value;
64 BOOST_REQUIRE_EQUAL(val,
true);
66 val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<1>>::type,
aggregate<float>>::value;
67 BOOST_REQUIRE_EQUAL(val,
true);
69 val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<2>>::type,
aggregate<float[3]>>::value;
70 BOOST_REQUIRE_EQUAL(val,
true);
80 bool val = std::is_same<boost::mpl::at<bfv,boost::mpl::int_<0>>::type,boost::mpl::int_<1>>::value;
81 BOOST_REQUIRE_EQUAL(val,
true);
83 val = std::is_same<boost::mpl::at<bfv,boost::mpl::int_<1>>::type,boost::mpl::int_<4>>::value;
84 BOOST_REQUIRE_EQUAL(val,
true);
86 val = std::is_same<boost::mpl::at<bfv,boost::mpl::int_<2>>::type,boost::mpl::int_<5>>::value;
87 BOOST_REQUIRE_EQUAL(val,
true);
89 val = std::is_same<boost::mpl::at<bfv,boost::mpl::int_<3>>::type,boost::mpl::int_<9>>::value;
90 BOOST_REQUIRE_EQUAL(val,
true);
100 typedef vmpl_sum_constant<5,bfv>::type vsc;
102 BOOST_REQUIRE_EQUAL(boost::mpl::size<vsc>::type::value,4);
104 bool val = std::is_same<boost::mpl::at<vsc,boost::mpl::int_<0>>::type,boost::mpl::int_<6>>::value;
105 BOOST_REQUIRE_EQUAL(val,
true);
107 val = std::is_same<boost::mpl::at<vsc,boost::mpl::int_<1>>::type,boost::mpl::int_<9>>::value;
108 BOOST_REQUIRE_EQUAL(val,
true);
110 val = std::is_same<boost::mpl::at<vsc,boost::mpl::int_<2>>::type,boost::mpl::int_<10>>::value;
111 BOOST_REQUIRE_EQUAL(val,
true);
113 val = std::is_same<boost::mpl::at<vsc,boost::mpl::int_<3>>::type,boost::mpl::int_<14>>::value;
114 BOOST_REQUIRE_EQUAL(val,
true);
120BOOST_AUTO_TEST_CASE( lin_vmpl_test )
122 typedef boost::mpl::vector<boost::mpl::int_<16>,boost::mpl::int_<17>,boost::mpl::int_<18>> vector;
124 typedef boost::mpl::vector<boost::mpl::int_<1>,boost::mpl::int_<2>,boost::mpl::int_<3>> offset;
126 int lino = Lin_vmpl_off<vector,offset>(0,0,0);
127 int lin = Lin_vmpl<vector>(0,0,0);
129 BOOST_REQUIRE_EQUAL(lino,1+2*16+3*16*17);
130 BOOST_REQUIRE_EQUAL(lin,0);
132 lino = Lin_vmpl_off<vector,offset>(0,1,0);
133 lin = Lin_vmpl<vector>(0,1,0);
135 BOOST_REQUIRE_EQUAL(lino,1+3*16+3*16*17);
136 BOOST_REQUIRE_EQUAL(lin,16);
138 lino = Lin_vmpl_off<vector,offset>(0,0,1);
139 lin = Lin_vmpl<vector>(0,0,1);
141 BOOST_REQUIRE_EQUAL(lino,1+2*16+4*16*17);
142 BOOST_REQUIRE_EQUAL(lin,16*17);
[v_transform metafunction]
aggregate< T > type
meta-function implementation
[v_transform metafunction]
aggregate< T > type
meta-function implementation
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...
boost::mpl::vector< boost::mpl::int_< id >... > type
construct an mpl vector from the variadic