Public Member Functions | List of all members
test_vectorAccess< Vector > Struct Template Reference

Public Member Functions

 test_vectorAccess ()
 

Detailed Description

template<typename Vector>
struct test_vectorAccess< Vector >

Definition at line 399 of file geo_vectors_utils_test.cc.

Constructor & Destructor Documentation

template<typename Vector >
test_vectorAccess< Vector >::test_vectorAccess ( )
inline

Definition at line 401 of file geo_vectors_utils_test.cc.

401  {
402  // BUG the double brace syntax is required to work around clang bug 21629
403  // (https://bugs.llvm.org/show_bug.cgi?id=21629)
404  std::array<double, 3U> const coords = {{ 1.0, 5.0, 9.0 }};
405  Vector v{ coords[0], coords[1], coords[2] };
406 
407  unsigned int iCoord = 0;
408  for(auto coordMan: geo::vect::coordManagers<Vector>()) {
409  auto const expected = coords[iCoord++];
410  auto mc = geo::vect::bindCoord(v, coordMan);
411  BOOST_TEST(mc() == expected);
412  BOOST_TEST(mc == expected);
413  } // for
414  BOOST_TEST(iCoord == 3U);
415 
416  auto x = geo::vect::Xcoord(v);
417  auto c0 = geo::vect::coord(v, 0U);
418  auto mx = geo::vect::bindCoord(v, geo::vect::XcoordManager<Vector>);
419  auto mc0 = geo::vect::bindCoord(v, geo::vect::coordManager<Vector>(0U));
420  BOOST_TEST(x() == 1.0);
421  BOOST_TEST(x == 1.0);
422  BOOST_TEST(x() == v.X());
423  BOOST_TEST(c0() == v.X());
424  BOOST_TEST(mx() == 1.0);
425  BOOST_TEST(mx == 1.0);
426  BOOST_TEST(mx() == v.X());
427  BOOST_TEST(mc0() == v.X());
428 
429  x = 2.0;
430  BOOST_TEST(x() == 2.0);
431  BOOST_TEST(x == 2.0);
432  BOOST_TEST(x() == v.X());
433  BOOST_TEST(c0() == v.X());
434  BOOST_TEST(mx() == 2.0);
435  BOOST_TEST(mx == 2.0);
436  BOOST_TEST(mx() == v.X());
437  BOOST_TEST(mc0() == v.X());
438 
439  x += 2.0;
440  BOOST_TEST(x() == 4.0);
441  BOOST_TEST(x == 4.0);
442  BOOST_TEST(x() == v.X());
443  BOOST_TEST(c0() == v.X());
444  BOOST_TEST(mx() == 4.0);
445  BOOST_TEST(mx == 4.0);
446  BOOST_TEST(mx() == v.X());
447  BOOST_TEST(mc0() == v.X());
448 
449  x -= 2.0;
450  BOOST_TEST(x() == 2.0);
451  BOOST_TEST(x == 2.0);
452  BOOST_TEST(x() == v.X());
453  BOOST_TEST(c0() == v.X());
454  BOOST_TEST(mx() == 2.0);
455  BOOST_TEST(mx == 2.0);
456  BOOST_TEST(mx() == v.X());
457  BOOST_TEST(mc0() == v.X());
458 
459  x *= 4.0;
460  BOOST_TEST(x() == 8.0);
461  BOOST_TEST(x == 8.0);
462  BOOST_TEST(x() == v.X());
463  BOOST_TEST(c0() == v.X());
464  BOOST_TEST(mx() == 8.0);
465  BOOST_TEST(mx == 8.0);
466  BOOST_TEST(mx() == v.X());
467  BOOST_TEST(mc0() == v.X());
468 
469  x /= 4.0;
470  BOOST_TEST(x() == 2.0);
471  BOOST_TEST(x == 2.0);
472  BOOST_TEST(x() == v.X());
473  BOOST_TEST(c0() == v.X());
474  BOOST_TEST(mx() == 2.0);
475  BOOST_TEST(mx == 2.0);
476  BOOST_TEST(mx() == v.X());
477  BOOST_TEST(mc0() == v.X());
478 
479  auto y = geo::vect::Ycoord(v);
480  auto c1 = geo::vect::coord(v, 1U);
481  auto my = geo::vect::bindCoord(v, geo::vect::YcoordManager<Vector>);
482  auto mc1 = geo::vect::bindCoord(v, geo::vect::coordManager<Vector>(1U));
483  BOOST_TEST(y() == 5.0);
484  BOOST_TEST(y == 5.0);
485  BOOST_TEST(y() == v.Y());
486  BOOST_TEST(c1() == v.Y());
487  BOOST_TEST(my() == 5.0);
488  BOOST_TEST(my == 5.0);
489  BOOST_TEST(my() == v.Y());
490  BOOST_TEST(mc1() == v.Y());
491 
492  y = 2.0;
493  BOOST_TEST(y() == 2.0);
494  BOOST_TEST(y == 2.0);
495  BOOST_TEST(y() == v.Y());
496  BOOST_TEST(c1() == v.Y());
497  BOOST_TEST(my() == 2.0);
498  BOOST_TEST(my == 2.0);
499  BOOST_TEST(my() == v.Y());
500  BOOST_TEST(mc1() == v.Y());
501 
502  y += 2.0;
503  BOOST_TEST(y() == 4.0);
504  BOOST_TEST(y == 4.0);
505  BOOST_TEST(y() == v.Y());
506  BOOST_TEST(c1() == v.Y());
507  BOOST_TEST(my() == 4.0);
508  BOOST_TEST(my == 4.0);
509  BOOST_TEST(my() == v.Y());
510  BOOST_TEST(mc1() == v.Y());
511 
512  y -= 2.0;
513  BOOST_TEST(y() == 2.0);
514  BOOST_TEST(y == 2.0);
515  BOOST_TEST(y() == v.Y());
516  BOOST_TEST(c1() == v.Y());
517  BOOST_TEST(my() == 2.0);
518  BOOST_TEST(my == 2.0);
519  BOOST_TEST(my() == v.Y());
520  BOOST_TEST(mc1() == v.Y());
521 
522  y *= 4.0;
523  BOOST_TEST(y() == 8.0);
524  BOOST_TEST(y == 8.0);
525  BOOST_TEST(y() == v.Y());
526  BOOST_TEST(c1() == v.Y());
527  BOOST_TEST(my() == 8.0);
528  BOOST_TEST(my == 8.0);
529  BOOST_TEST(my() == v.Y());
530  BOOST_TEST(mc1() == v.Y());
531 
532  y /= 4.0;
533  BOOST_TEST(y() == 2.0);
534  BOOST_TEST(y == 2.0);
535  BOOST_TEST(y() == v.Y());
536  BOOST_TEST(c1() == v.Y());
537  BOOST_TEST(my() == 2.0);
538  BOOST_TEST(my == 2.0);
539  BOOST_TEST(my() == v.Y());
540  BOOST_TEST(mc1() == v.Y());
541 
542  auto z = geo::vect::Zcoord(v);
543  auto c2 = geo::vect::coord(v, 2U);
544  auto mz = geo::vect::bindCoord(v, geo::vect::ZcoordManager<Vector>);
545  auto mc2 = geo::vect::bindCoord(v, geo::vect::coordManager<Vector>(2U));
546  BOOST_TEST(z() == 9.0);
547  BOOST_TEST(z == 9.0);
548  BOOST_TEST(z() == v.Z());
549  BOOST_TEST(c2() == v.Z());
550  BOOST_TEST(mz() == 9.0);
551  BOOST_TEST(mz == 9.0);
552  BOOST_TEST(mz() == v.Z());
553  BOOST_TEST(mc2() == v.Z());
554 
555  z = 2.0;
556  BOOST_TEST(z() == 2.0);
557  BOOST_TEST(z == 2.0);
558  BOOST_TEST(z() == v.Z());
559  BOOST_TEST(c2() == v.Z());
560  BOOST_TEST(mz() == 2.0);
561  BOOST_TEST(mz == 2.0);
562  BOOST_TEST(mz() == v.Z());
563  BOOST_TEST(mc2() == v.Z());
564 
565  z += 2.0;
566  BOOST_TEST(z() == 4.0);
567  BOOST_TEST(z == 4.0);
568  BOOST_TEST(z() == v.Z());
569  BOOST_TEST(c2() == v.Z());
570  BOOST_TEST(mz() == 4.0);
571  BOOST_TEST(mz == 4.0);
572  BOOST_TEST(mz() == v.Z());
573  BOOST_TEST(mc2() == v.Z());
574 
575  z -= 2.0;
576  BOOST_TEST(z() == 2.0);
577  BOOST_TEST(z == 2.0);
578  BOOST_TEST(z() == v.Z());
579  BOOST_TEST(c2() == v.Z());
580  BOOST_TEST(mz() == 2.0);
581  BOOST_TEST(mz == 2.0);
582  BOOST_TEST(mz() == v.Z());
583  BOOST_TEST(mc2() == v.Z());
584 
585  z *= 4.0;
586  BOOST_TEST(z() == 8.0);
587  BOOST_TEST(z == 8.0);
588  BOOST_TEST(z() == v.Z());
589  BOOST_TEST(c2() == v.Z());
590  BOOST_TEST(mz() == 8.0);
591  BOOST_TEST(mz == 8.0);
592  BOOST_TEST(mz() == v.Z());
593  BOOST_TEST(mc2() == v.Z());
594 
595  z /= 4.0;
596  BOOST_TEST(z() == 2.0);
597  BOOST_TEST(z == 2.0);
598  BOOST_TEST(z() == v.Z());
599  BOOST_TEST(c2() == v.Z());
600  BOOST_TEST(mz() == 2.0);
601  BOOST_TEST(mz == 2.0);
602  BOOST_TEST(mz() == v.Z());
603  BOOST_TEST(mc2() == v.Z());
604 
605  } // test_vectorAccess()
auto Zcoord(Vector &v)
Returns an object to manage the coordinate Z of the vector v.
const char expected[]
Definition: Exception_t.cc:22
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
constexpr auto bindCoord(Vector const &v, CoordReader_t< Vector > helper)
Binds the specified constant vector to the coordinate reader.
auto Ycoord(Vector &v)
Returns an object to manage the coordinate Y of the vector v.
auto Xcoord(Vector &v)
Returns an object to manage the coordinate X of the vector v.
list x
Definition: train.py:276

The documentation for this struct was generated from the following file: