8#ifndef OPENFPM_DATA_SRC_UTIL_META_CC_UNIT_TESTS_HPP_
9#define OPENFPM_DATA_SRC_UTIL_META_CC_UNIT_TESTS_HPP_
11#include "meta_copy.hpp"
12#include "meta_compare.hpp"
13#include "data_type/aggregate.hpp"
14#include "Point_test.hpp"
16BOOST_AUTO_TEST_SUITE( util_test )
18BOOST_AUTO_TEST_CASE( meta_copy_compare_test )
28 BOOST_REQUIRE_EQUAL(f_src,f_dst);
32 BOOST_REQUIRE_EQUAL(ret,
true);
38 BOOST_REQUIRE_EQUAL(ret,
false);
45 float f_src[2][3] = {{1.0,2.9,4.0},{2.3,4.4,9.0}};
52 BOOST_REQUIRE_EQUAL(ret,
true);
58 BOOST_REQUIRE_EQUAL(ret,
false);
68 boost::fusion::at_c<0>(agg1.
data) = 1.0;
69 boost::fusion::at_c<1>(agg1.
data) = 2.0;
70 boost::fusion::at_c<2>(agg1.
data)[0] = 3.0;
71 boost::fusion::at_c<2>(agg1.
data)[1] = 4.0;
72 boost::fusion::at_c<2>(agg1.
data)[2] = 5.0;
78 BOOST_REQUIRE_EQUAL(ret,
true);
82 boost::fusion::at_c<2>(agg2.
data)[2] = 2.0;
85 BOOST_REQUIRE_EQUAL(ret,
false);
92 std::string s_src(
"Test string");
97 BOOST_REQUIRE_EQUAL(s_src,s_dst);
101 BOOST_REQUIRE_EQUAL(ret,
true);
105 s_dst = std::string(
"Test string2");
107 BOOST_REQUIRE_EQUAL(ret,
false);
117 a_src.template get<0>() = std::string(
"Test string");
119 a_src.template get<1>().push_back(5.0);
120 a_src.template get<1>().push_back(15.0);
121 a_src.template get<1>().push_back(45.0);
122 a_src.template get<1>().push_back(7.0);
124 a_src.template get<2>()[0] = std::string(
"Test string 2");
125 a_src.template get<2>()[10] = std::string(
"Test string 3");
126 a_src.template get<2>()[9] = std::string(
"Test string 4");
127 a_src.template get<2>()[1] = std::string(
"Test string 5");
129 a_src.template get<3>()[0] = std::string(
"Last string 9");
130 a_src.template get<3>()[1] = std::string(
"Last string 10");
131 a_src.template get<3>()[2] = std::string(
"Last string 11");
139 BOOST_REQUIRE_EQUAL(ret,
true);
143 a_dst.template get<3>()[1] = std::string(
"Last string 20");
145 BOOST_REQUIRE_EQUAL(ret,
false);
160 p_src.template get<p::x>() = 1;
161 p_src.template get<p::y>() = 567;
162 p_src.template get<p::z>() = 341;
163 p_src.template get<p::s>() = 5670;
164 p_src.template get<p::v>()[0] = 921;
165 p_src.template get<p::v>()[1] = 5675;
166 p_src.template get<p::v>()[2] = 117;
167 p_src.template get<p::t>()[0][0] = 1921;
168 p_src.template get<p::t>()[0][1] = 25675;
169 p_src.template get<p::t>()[0][2] = 3117;
170 p_src.template get<p::t>()[1][0] = 4921;
171 p_src.template get<p::t>()[1][1] = 55675;
172 p_src.template get<p::t>()[1][2] = 6117;
173 p_src.template get<p::t>()[2][0] = 7921;
174 p_src.template get<p::t>()[2][1] = 85675;
175 p_src.template get<p::t>()[2][2] = 9117;
180 BOOST_REQUIRE_EQUAL(ret,
true);
184 p_dst.template get<p::t>()[2][2] = 9317;
186 BOOST_REQUIRE_EQUAL(ret,
false);
192BOOST_AUTO_TEST_CASE( meta_copy_test_op )
202 BOOST_REQUIRE_EQUAL(f_dst,3.0);
211 float f_src[2][3] = {{1.0,2.5,4.0},{2.5,4.5,9.0}};
212 float f_dst[2][3] = {{1.0,2.0,3.0},{1.0,2.0,3.0}};
216 BOOST_REQUIRE_EQUAL(f_dst[0][0],2.0);
217 BOOST_REQUIRE_EQUAL(f_dst[0][1],4.5);
218 BOOST_REQUIRE_EQUAL(f_dst[0][2],7.0);
220 BOOST_REQUIRE_EQUAL(f_dst[1][0],3.5);
221 BOOST_REQUIRE_EQUAL(f_dst[1][1],6.5);
222 BOOST_REQUIRE_EQUAL(f_dst[1][2],12.0);
234 boost::fusion::at_c<0>(agg1.
data) = 1.0;
235 boost::fusion::at_c<1>(agg1.
data) = 2.0;
236 boost::fusion::at_c<2>(agg1.
data)[0] = 3.0;
237 boost::fusion::at_c<2>(agg1.
data)[1] = 4.0;
238 boost::fusion::at_c<2>(agg1.
data)[2] = 5.0;
240 boost::fusion::at_c<0>(agg2.
data) = 1.0;
241 boost::fusion::at_c<1>(agg2.
data) = 2.0;
242 boost::fusion::at_c<2>(agg2.
data)[0] = 3.0;
243 boost::fusion::at_c<2>(agg2.
data)[1] = 4.0;
244 boost::fusion::at_c<2>(agg2.
data)[2] = 5.0;
248 BOOST_REQUIRE_EQUAL(boost::fusion::at_c<0>(agg2.
data),2.0);
249 BOOST_REQUIRE_EQUAL(boost::fusion::at_c<1>(agg2.
data),4.0);
250 BOOST_REQUIRE_EQUAL(boost::fusion::at_c<2>(agg2.
data)[0],6.0);
251 BOOST_REQUIRE_EQUAL(boost::fusion::at_c<2>(agg2.
data)[1],8.0);
252 BOOST_REQUIRE_EQUAL(boost::fusion::at_c<2>(agg2.
data)[2],10.0);
262 std::string s_src(
"Test string");
263 std::string s_dst(
"Test string2");
267 BOOST_REQUIRE_EQUAL(s_dst,std::string(
"Test string2Test string"));
284 p_src.template get<p::x>() = 1;
285 p_src.template get<p::y>() = 567;
286 p_src.template get<p::z>() = 341;
287 p_src.template get<p::s>() = 5670;
288 p_src.template get<p::v>()[0] = 921;
289 p_src.template get<p::v>()[1] = 5675;
290 p_src.template get<p::v>()[2] = 117;
291 p_src.template get<p::t>()[0][0] = 1921;
292 p_src.template get<p::t>()[0][1] = 25675;
293 p_src.template get<p::t>()[0][2] = 3117;
294 p_src.template get<p::t>()[1][0] = 4921;
295 p_src.template get<p::t>()[1][1] = 55675;
296 p_src.template get<p::t>()[1][2] = 6117;
297 p_src.template get<p::t>()[2][0] = 7921;
298 p_src.template get<p::t>()[2][1] = 85675;
299 p_src.template get<p::t>()[2][2] = 9117;
302 p_dst.template get<p::x>() = 2;
303 p_dst.template get<p::y>() = 568;
304 p_dst.template get<p::z>() = 342;
305 p_dst.template get<p::s>() = 5671;
306 p_dst.template get<p::v>()[0] = 922;
307 p_dst.template get<p::v>()[1] = 5676;
308 p_dst.template get<p::v>()[2] = 118;
309 p_dst.template get<p::t>()[0][0] = 1922;
310 p_dst.template get<p::t>()[0][1] = 25676;
311 p_dst.template get<p::t>()[0][2] = 3118;
312 p_dst.template get<p::t>()[1][0] = 4922;
313 p_dst.template get<p::t>()[1][1] = 55676;
314 p_dst.template get<p::t>()[1][2] = 6118;
315 p_dst.template get<p::t>()[2][0] = 7922;
316 p_dst.template get<p::t>()[2][1] = 85676;
317 p_dst.template get<p::t>()[2][2] = 9118;
321 BOOST_REQUIRE_EQUAL(p_dst.template get<p::x>(),3);
322 BOOST_REQUIRE_EQUAL(p_dst.template get<p::y>(),1135);
323 BOOST_REQUIRE_EQUAL(p_dst.template get<p::z>(),683);
324 BOOST_REQUIRE_EQUAL(p_dst.template get<p::v>()[0],1843);
325 BOOST_REQUIRE_EQUAL(p_dst.template get<p::v>()[1],11351);
326 BOOST_REQUIRE_EQUAL(p_dst.template get<p::v>()[2],235);
327 BOOST_REQUIRE_EQUAL(p_dst.template get<p::t>()[0][0],3843);
328 BOOST_REQUIRE_EQUAL(p_dst.template get<p::t>()[0][1],51351);
329 BOOST_REQUIRE_EQUAL(p_dst.template get<p::t>()[0][2],6235);
330 BOOST_REQUIRE_EQUAL(p_dst.template get<p::t>()[1][0],9843);
331 BOOST_REQUIRE_EQUAL(p_dst.template get<p::t>()[1][1],111351);
332 BOOST_REQUIRE_EQUAL(p_dst.template get<p::t>()[1][2],12235);
333 BOOST_REQUIRE_EQUAL(p_dst.template get<p::t>()[2][0],15843);
334 BOOST_REQUIRE_EQUAL(p_dst.template get<p::t>()[2][1],171351);
335 BOOST_REQUIRE_EQUAL(p_dst.template get<p::t>()[2][2],18235);
342BOOST_AUTO_TEST_CASE( meta_copy_d_compare_test )
352 BOOST_REQUIRE_EQUAL(f_src,f_dst);
361 float f_src[2][3] = {{1.0,2.9,4.0},{2.3,4.4,9.0}};
366 BOOST_REQUIRE_EQUAL(f_src[0][0],f_dst[0][0]);
367 BOOST_REQUIRE_EQUAL(f_src[0][1],f_dst[0][1]);
368 BOOST_REQUIRE_EQUAL(f_src[0][2],f_dst[0][2]);
369 BOOST_REQUIRE_EQUAL(f_src[1][0],f_dst[1][0]);
370 BOOST_REQUIRE_EQUAL(f_src[1][1],f_dst[1][1]);
371 BOOST_REQUIRE_EQUAL(f_src[1][2],f_dst[1][2]);
383 boost::fusion::at_c<0>(agg1.
data) = 1.0;
384 boost::fusion::at_c<1>(agg1.
data) = 2.0;
385 boost::fusion::at_c<2>(agg1.
data)[0] = 3.0;
386 boost::fusion::at_c<2>(agg1.
data)[1] = 4.0;
387 boost::fusion::at_c<2>(agg1.
data)[2] = 5.0;
391 BOOST_REQUIRE_EQUAL(boost::fusion::at_c<0>(agg1.
data),boost::fusion::at_c<0>(agg2.
data));
392 BOOST_REQUIRE_EQUAL(boost::fusion::at_c<1>(agg1.
data),boost::fusion::at_c<1>(agg2.
data));
393 BOOST_REQUIRE_EQUAL(boost::fusion::at_c<2>(agg1.
data)[0],boost::fusion::at_c<2>(agg2.
data)[0]);
394 BOOST_REQUIRE_EQUAL(boost::fusion::at_c<2>(agg1.
data)[1],boost::fusion::at_c<2>(agg2.
data)[1]);
395 BOOST_REQUIRE_EQUAL(boost::fusion::at_c<2>(agg1.
data)[2],boost::fusion::at_c<2>(agg2.
data)[2]);
404 std::string s_src(
"Test string");
409 BOOST_REQUIRE_EQUAL(s_src,s_dst);
421 a_src.template get<0>() = std::string(
"Test string");
423 a_src.template get<1>().push_back(5.0);
424 a_src.template get<1>().push_back(15.0);
425 a_src.template get<1>().push_back(45.0);
426 a_src.template get<1>().push_back(7.0);
428 a_src.template get<2>()[0] = std::string(
"Test string 2");
429 a_src.template get<2>()[10] = std::string(
"Test string 3");
430 a_src.template get<2>()[9] = std::string(
"Test string 4");
431 a_src.template get<2>()[1] = std::string(
"Test string 5");
433 a_src.template get<3>()[0] = std::string(
"Last string 9");
434 a_src.template get<3>()[1] = std::string(
"Last string 10");
435 a_src.template get<3>()[2] = std::string(
"Last string 11");
443 BOOST_REQUIRE_EQUAL(a_src.template get<0>(),a_dst.template get<0>());
444 BOOST_REQUIRE_EQUAL(a_src.template get<1>()[0],a_dst.template get<1>()[0]);
445 BOOST_REQUIRE_EQUAL(a_src.template get<1>()[1],a_dst.template get<1>()[1]);
446 BOOST_REQUIRE_EQUAL(a_src.template get<1>()[2],a_dst.template get<1>()[2]);
447 BOOST_REQUIRE_EQUAL(a_src.template get<1>()[3],a_dst.template get<1>()[3]);
449 BOOST_REQUIRE_EQUAL(a_src.template get<2>()[0],a_dst.template get<2>()[0]);
450 BOOST_REQUIRE_EQUAL(a_src.template get<2>()[10],a_dst.template get<2>()[10]);
451 BOOST_REQUIRE_EQUAL(a_src.template get<2>()[9],a_dst.template get<2>()[9]);
452 BOOST_REQUIRE_EQUAL(a_src.template get<2>()[1],a_dst.template get<2>()[1]);
454 BOOST_REQUIRE_EQUAL(a_src.template get<3>()[0],a_dst.template get<3>()[0]);
455 BOOST_REQUIRE_EQUAL(a_src.template get<3>()[1],a_dst.template get<3>()[1]);
456 BOOST_REQUIRE_EQUAL(a_src.template get<3>()[2],a_dst.template get<3>()[2]);
473 p_src.template get<p::x>() = 1;
474 p_src.template get<p::y>() = 567;
475 p_src.template get<p::z>() = 341;
476 p_src.template get<p::s>() = 5670;
477 p_src.template get<p::v>()[0] = 921;
478 p_src.template get<p::v>()[1] = 5675;
479 p_src.template get<p::v>()[2] = 117;
480 p_src.template get<p::t>()[0][0] = 1921;
481 p_src.template get<p::t>()[0][1] = 25675;
482 p_src.template get<p::t>()[0][2] = 3117;
483 p_src.template get<p::t>()[1][0] = 4921;
484 p_src.template get<p::t>()[1][1] = 55675;
485 p_src.template get<p::t>()[1][2] = 6117;
486 p_src.template get<p::t>()[2][0] = 7921;
487 p_src.template get<p::t>()[2][1] = 85675;
488 p_src.template get<p::t>()[2][2] = 9117;
492 BOOST_REQUIRE_EQUAL(p_src.template get<p::x>(),p_dst.template get<p::x>());
493 BOOST_REQUIRE_EQUAL(p_src.template get<p::y>(),p_dst.template get<p::y>());
494 BOOST_REQUIRE_EQUAL(p_src.template get<p::z>(),p_dst.template get<p::z>());
495 BOOST_REQUIRE_EQUAL(p_src.template get<p::s>(),p_dst.template get<p::s>());
497 BOOST_REQUIRE_EQUAL(p_src.template get<p::v>()[0],p_dst.template get<p::v>()[0]);
498 BOOST_REQUIRE_EQUAL(p_src.template get<p::v>()[1],p_dst.template get<p::v>()[1]);
499 BOOST_REQUIRE_EQUAL(p_src.template get<p::v>()[2],p_dst.template get<p::v>()[2]);
501 BOOST_REQUIRE_EQUAL(p_src.template get<p::t>()[0][0],p_dst.template get<p::t>()[0][0]);
502 BOOST_REQUIRE_EQUAL(p_src.template get<p::t>()[0][1],p_dst.template get<p::t>()[0][1]);
503 BOOST_REQUIRE_EQUAL(p_src.template get<p::t>()[0][2],p_dst.template get<p::t>()[0][2]);
504 BOOST_REQUIRE_EQUAL(p_src.template get<p::t>()[1][0],p_dst.template get<p::t>()[1][0]);
505 BOOST_REQUIRE_EQUAL(p_src.template get<p::t>()[1][1],p_dst.template get<p::t>()[1][1]);
506 BOOST_REQUIRE_EQUAL(p_src.template get<p::t>()[1][2],p_dst.template get<p::t>()[1][2]);
507 BOOST_REQUIRE_EQUAL(p_src.template get<p::t>()[2][0],p_dst.template get<p::t>()[2][0]);
508 BOOST_REQUIRE_EQUAL(p_src.template get<p::t>()[2][1],p_dst.template get<p::t>()[2][1]);
509 BOOST_REQUIRE_EQUAL(p_src.template get<p::t>()[2][2],p_dst.template get<p::t>()[2][2]);
516BOOST_AUTO_TEST_SUITE_END()
Test structure used for several test.
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...