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

Function testMakeInfinite

src/ImathTest/testBox.cpp:169–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167
168template <class T>
169void
170testMakeInfinite (const char* type)
171{
172 cout << " makeInfinite() for type " << type << endl;
173
174 //
175 // Infinite box
176 //
177 {
178 IMATH_INTERNAL_NAMESPACE::Box<T> b;
179 b.makeInfinite ();
180 assert (
181 b.min == T (T::baseTypeLowest ()) &&
182 b.max == T (T::baseTypeMax ()));
183
184 for (unsigned int i=0; i<b.min.dimensions(); i++)
185 {
186 IMATH_INTERNAL_NAMESPACE::Box<T> c = b;
187 c.max[i] = 0;
188 assert (!c.isInfinite());
189
190 c = b;
191 c.min[i] = 0;
192 assert (!c.isInfinite());
193 }
194 }
195
196 //
197 // Non-empty, has volume
198 //
199 {
200 IMATH_INTERNAL_NAMESPACE::Box<T> b (T (-1), T (1));
201 b.makeInfinite ();
202 assert (
203 b.min == T (T::baseTypeLowest ()) &&
204 b.max == T (T::baseTypeMax ()));
205 }
206
207 //
208 // Non-empty, no volume
209 // Boxes are:
210 // 2D: [(0, 0), (0, 1) ]
211 // 3D: [(0, 0, 0), (0, 0, 1) ]
212 // 4D: [(0, 0, 0, 0), (0, 0, 0, 1)]
213 //
214 {
215 T min (0);
216 T max (0);
217 max[T::dimensions () - 1] = 1;
218
219 IMATH_INTERNAL_NAMESPACE::Box<T> b (min, max);
220 b.makeInfinite ();
221 assert (
222 b.min == T (T::baseTypeLowest ()) &&
223 b.max == T (T::baseTypeMax ()));
224 }
225}
226

Callers

nothing calls this directly

Calls 3

makeInfiniteMethod · 0.80
TClass · 0.50
dimensionsFunction · 0.50

Tested by

no test coverage detected