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

Function testMakeEmpty

src/ImathTest/testBox.cpp:121–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119
120template <class T>
121void
122testMakeEmpty (const char* type)
123{
124 cout << " makeEmpty() for type " << type << endl;
125
126 //
127 // Empty box
128 //
129 {
130 IMATH_INTERNAL_NAMESPACE::Box<T> b;
131 b.makeEmpty ();
132 assert (
133 b.min == T (T::baseTypeMax ()) &&
134 b.max == T (T::baseTypeLowest ()));
135 }
136
137 //
138 // Non-empty, has volume
139 //
140 {
141 IMATH_INTERNAL_NAMESPACE::Box<T> b (T (-1), T (1));
142 b.makeEmpty ();
143 assert (
144 b.min == T (T::baseTypeMax ()) &&
145 b.max == T (T::baseTypeLowest ()));
146 }
147
148 //
149 // Non-empty, no volume
150 // Boxes are:
151 // 2D: [(0, 0), (0, 1) ]
152 // 3D: [(0, 0, 0), (0, 0, 1) ]
153 // 4D: [(0, 0, 0, 0), (0, 0, 0, 1)]
154 //
155 {
156 T min (0);
157 T max (0);
158 max[T::dimensions () - 1] = 1;
159
160 IMATH_INTERNAL_NAMESPACE::Box<T> b (min, max);
161 b.makeEmpty ();
162 assert (
163 b.min == T (T::baseTypeMax ()) &&
164 b.max == T (T::baseTypeLowest ()));
165 }
166}
167
168template <class T>
169void

Callers

nothing calls this directly

Calls 3

makeEmptyMethod · 0.80
TClass · 0.50
dimensionsFunction · 0.50

Tested by

no test coverage detected