MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/Imath / testSize

Function testSize

src/ImathTest/testBox.cpp:606–661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

604
605template <class T>
606void
607testSize (const char* type)
608{
609 cout << " size() for type " << type << endl;
610
611 //
612 // Size of empty box.
613 //
614 {
615 IMATH_INTERNAL_NAMESPACE::Box<T> b;
616 assert (b.size () == T (0));
617 }
618
619 //
620 // Size of non-empty, has-volume box.
621 // Boxes are:
622 // 2D: [(-1, -1), (1, 1) ]
623 // 3D: [(-1, -1, -1), (1, 1, 1) ]
624 // 4D: [(-1, -1, -1, -1), (1, 1, 1, 1) ]
625 //
626 // and
627 //
628 // 2D: [(-1, -2), (1, 2) ]
629 // 3D: [(-1, -2, -3), (1, 2, 3) ]
630 // 4D: [(-1, -2, -3, -4), (1, 2, 3, 4) ]
631 //
632 {
633 IMATH_INTERNAL_NAMESPACE::Box<T> b0 (T (-1), T (1));
634 assert (b0.size () == T (2));
635
636 T p;
637 for (unsigned int i = 0; i < T::dimensions (); i++)
638 {
639 p[i] = static_cast<typename T::BaseType>(i);
640 }
641 IMATH_INTERNAL_NAMESPACE::Box<T> b1 (-p, p);
642 assert (b1.size () == p * T (2));
643 }
644
645 //
646 // Size of non-empty, no-volume box.
647 // Boxes are:
648 // 2D: [(0, 0), (0, 1) ]
649 // 3D: [(0, 0, 0), (0, 0, 1) ]
650 // 4D: [(0, 0, 0, 0), (0, 0, 0, 1)]
651 //
652 {
653 T min (0);
654 T max = min;
655 max[T::dimensions () - 1] = 1;
656
657 IMATH_INTERNAL_NAMESPACE::Box<T> b (min, max);
658
659 assert (b.size () == max);
660 }
661}
662
663template <class T>

Callers

nothing calls this directly

Calls 3

TClass · 0.50
dimensionsFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected