| 805 | |
| 806 | |
| 807 | void |
| 808 | testC3 () |
| 809 | { |
| 810 | object mainModule ((handle<> (borrowed (PyImport_AddModule ("__main__"))))); |
| 811 | object mainNamespace = mainModule.attr ("__dict__"); |
| 812 | |
| 813 | std::cerr << "Testing C3*:\n"; |
| 814 | |
| 815 | std::string code = |
| 816 | "from imath import *\n" |
| 817 | "c3c = Color3c (1, 2, 3)\n" |
| 818 | "c3f = Color3f (1.1, 2.2, 3.3)\n" |
| 819 | "t3c = (4, 5, 6)\n" |
| 820 | "t3f = (4.4, 5.5, 6.6)\n" |
| 821 | "v3i = V3i (7, 8, 9)\n" |
| 822 | "v3f = V3f (10.10, 11.11, 12.12)\n" |
| 823 | "v3d = V3f (13.13, 14.14, 15.15)\n" |
| 824 | "l3c = [16, 17, 18]\n" |
| 825 | "l3f = [19.19, 20.20, 21.21]\n" |
| 826 | "i = 1\n" |
| 827 | "from wrap import *\n" |
| 828 | "w = wrap ('Color3c')\n" |
| 829 | "assert w == Color3c (1, 2, 3)\n" |
| 830 | "w = wrap ('Color3f')\n" |
| 831 | "assert equal (w[0], 1.1, 1e-6)\n" |
| 832 | "assert equal (w[1], 2.2, 1e-6)\n" |
| 833 | "assert equal (w[2], 3.3, 1e-6)\n"; |
| 834 | |
| 835 | handle<> ignored (PyRun_String (code.c_str(), Py_file_input, |
| 836 | mainNamespace.ptr(), mainNamespace.ptr())); |
| 837 | |
| 838 | // |
| 839 | |
| 840 | extract <object> ec3c (mainNamespace ["c3c"]); |
| 841 | assert (ec3c.check()); |
| 842 | |
| 843 | PyObject *c3cObj = ec3c().ptr(); |
| 844 | assert (c3cObj != 0); |
| 845 | |
| 846 | extract <object> ec3f (mainNamespace ["c3f"]); |
| 847 | assert (ec3f.check()); |
| 848 | |
| 849 | PyObject *c3fObj = ec3f().ptr(); |
| 850 | assert (c3fObj != 0); |
| 851 | |
| 852 | extract <object> et3c (mainNamespace ["t3c"]); |
| 853 | assert (et3c.check()); |
| 854 | |
| 855 | PyObject *t3cObj = et3c().ptr(); |
| 856 | assert (t3cObj != 0); |
| 857 | |
| 858 | extract <object> et3f (mainNamespace ["t3f"]); |
| 859 | assert (et3f.check()); |
| 860 | |
| 861 | PyObject *t3fObj = et3f().ptr(); |
| 862 | assert (t3fObj != 0); |
| 863 | |
| 864 | extract <object> ev3i (mainNamespace ["v3i"]); |
nothing calls this directly
no test coverage detected