| 226 | |
| 227 | template <class T> |
| 228 | void |
| 229 | testExtendByPoint (const char* type) |
| 230 | { |
| 231 | cout << " extendBy() point for type " << type << endl; |
| 232 | |
| 233 | IMATH_INTERNAL_NAMESPACE::Rand32 rand (0); |
| 234 | |
| 235 | const unsigned int iters = 10; |
| 236 | |
| 237 | // |
| 238 | // Extend empty box with a single point. |
| 239 | // |
| 240 | for (unsigned int i = 0; i < iters; i++) |
| 241 | { |
| 242 | T p; |
| 243 | for (unsigned int j = 0; j < T::dimensions (); j++) |
| 244 | p[j] = typename T::BaseType (rand.nextf (-12345, 12345)); |
| 245 | |
| 246 | IMATH_INTERNAL_NAMESPACE::Box<T> b; |
| 247 | b.extendBy (p); |
| 248 | assert (b.min == p && b.max == p); |
| 249 | } |
| 250 | |
| 251 | // |
| 252 | // Extend empty box with a number of random points. Note that |
| 253 | // this also covers extending a non-empty box. |
| 254 | // |
| 255 | for (unsigned int i = 0; i < iters; i++) |
| 256 | { |
| 257 | IMATH_INTERNAL_NAMESPACE::Box<T> b; |
| 258 | |
| 259 | T min; |
| 260 | T max; |
| 261 | |
| 262 | for (unsigned int j = 0; j < i; j++) |
| 263 | { |
| 264 | T p; |
| 265 | for (unsigned int k = 0; k < T::dimensions (); k++) |
| 266 | p[k] = typename T::BaseType (rand.nextf (-12345, 12345)); |
| 267 | |
| 268 | if (j == 0) |
| 269 | { |
| 270 | min = p; |
| 271 | max = p; |
| 272 | } |
| 273 | for (unsigned int k = 0; k < T::dimensions (); k++) |
| 274 | { |
| 275 | min[k] = std::min (min[k], p[k]); |
| 276 | max[k] = std::max (max[k], p[k]); |
| 277 | } |
| 278 | |
| 279 | b.extendBy (p); |
| 280 | |
| 281 | assert (b.min == min && b.max == max); |
| 282 | } |
| 283 | } |
| 284 | } |
| 285 |
nothing calls this directly
no test coverage detected