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

Function testBox3

src/python/PyImathTest/main.cpp:504–804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

502
503
504void
505testBox3 ()
506{
507 object mainModule ((handle<> (borrowed (PyImport_AddModule ("__main__")))));
508 object mainNamespace = mainModule.attr ("__dict__");
509
510 std::cerr << "Testing Box3*:\n";
511
512 std::string code =
513 "from imath import *\n"
514 "b3i = Box3i ((1, 2, 3), (4, 5, 6))\n"
515 "b3f = Box3f ((7.7, 8.8, 9.9), (10.10, 11.11, 12.12))\n"
516 "b3d = Box3d ((13.13, 14.14, 15.15), (16.16, 17.17, 18.18))\n"
517 "t2i = ((1, 2, 3), (4, 5, 6))\n"
518 "t2V3i = (V3i (1, 2, 3), V3i (4, 5, 6))\n"
519 "t2iMix = (V3i (1, 2, 3), (4, 5, 6))\n"
520 "t2f = ((7.7, 8.8, 9.9), (10.10, 11.11, 12.12))\n"
521 "t2V3f = (V3f (7.7, 8.8, 9.9), V3f (10.10, 11.11, 12.12))\n"
522 "t2fMix = (V3f (7.7, 8.8, 9.9), (10.10, 11.11, 12.12))\n"
523 "t2V3d = (V3d (13.13, 14.14, 15.15), V3d (16.16, 17.17, 18.18))\n"
524 "t2dMix = (V3d (13.13, 14.14, 15.15), (16.16, 17.17, 18.18))\n"
525 "i = 1\n"
526 "from wrap import *\n"
527 "w = wrap ('Box3i')\n"
528 "assert w == Box3i ((1, 2, 3), (4, 5, 6))\n"
529 "w = wrap ('Box3f')\n"
530 "assert w.min().equalWithAbsError ((1.1, 2.2, 3.3), 1e-7)\n"
531 "assert w.max().equalWithAbsError ((4.4, 5.5, 6.6), 1e-7)\n"
532 "w = wrap ('Box3d')\n"
533 "assert w.min().equalWithAbsError ((1.1, 2.2, 3.3), 1e-7)\n"
534 "assert w.max().equalWithAbsError ((4.4, 5.5, 6.6), 1e-7)\n";
535
536 handle<> ignored (PyRun_String (code.c_str(), Py_file_input,
537 mainNamespace.ptr(), mainNamespace.ptr()));
538
539 //
540
541 extract <object> eb3i (mainNamespace ["b3i"]);
542 assert (eb3i.check());
543
544 PyObject *b3iObj = eb3i().ptr();
545 assert (b3iObj != 0);
546
547 extract <object> eb3f (mainNamespace ["b3f"]);
548 assert (eb3f.check());
549
550 PyObject *b3fObj = eb3f().ptr();
551 assert (b3fObj != 0);
552
553 extract <object> eb3d (mainNamespace ["b3d"]);
554 assert (eb3d.check());
555
556 PyObject *b3dObj = eb3d().ptr();
557 assert (b3dObj != 0);
558
559 extract <object> et2i (mainNamespace["t2i"]);
560 assert (et2i.check());
561

Callers

nothing calls this directly

Calls 1

equalWithAbsErrorMethod · 0.80

Tested by

no test coverage detected