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

Function testShear

src/python/PyImathTest/main.cpp:1891–2055  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1889
1890
1891void
1892testShear ()
1893{
1894 object mainModule ((handle<> (borrowed (PyImport_AddModule ("__main__")))));
1895 object mainNamespace = mainModule.attr ("__dict__");
1896
1897 std::cerr << "Testing Shear6*:\n";
1898
1899 std::string code =
1900 "from imath import *\n"
1901 "s6f = Shear6f (1.1, 2.2, 3.3, 4.4, 5.5, 6.6)\n"
1902 "s6d = Shear6d (7.7, 8.8, 9.9, 10.10, 11.11, 12.12)\n"
1903 "t3 = (13.13, 14.14, 15.15)\n"
1904 "t6 = (16.16, 17.17, 18.18, 19.19, 20.20, 21.21)\n"
1905 "v3i = V3i (22, 23, 24)\n"
1906 "v3f = V3f (25.25, 26.26, 27.27)\n"
1907 "v3d = V3d (28.28, 29.29, 30.30)\n"
1908 "i = 1\n"
1909 "from wrap import *\n"
1910 "w = wrap ('Shear6f')\n"
1911 "assert w.equalWithAbsError (s6f, 1e-6)\n"
1912 "w = wrap ('Shear6d')\n"
1913 "s6d2 = Shear6d (s6f)\n"
1914 "assert w.equalWithAbsError (s6d2, 1e-6)\n";
1915
1916 handle<> ignored (PyRun_String (code.c_str(), Py_file_input,
1917 mainNamespace.ptr(), mainNamespace.ptr()));
1918
1919 //
1920
1921 extract <object> es6f (mainNamespace["s6f"]);
1922 assert (es6f.check());
1923 PyObject *s6fObj = es6f().ptr();
1924 assert (s6fObj != 0);
1925
1926 extract <object> es6d (mainNamespace["s6d"]);
1927 assert (es6d.check());
1928
1929 PyObject *s6dObj = es6d().ptr();
1930 assert (s6dObj != 0);
1931
1932 extract <object> et3 (mainNamespace["t3"]);
1933 assert (et3.check());
1934
1935 PyObject *t3Obj = et3().ptr();
1936 assert (t3Obj != 0);
1937
1938 extract <object> et6 (mainNamespace["t6"]);
1939 assert (et6.check());
1940
1941 PyObject *t6Obj = et6().ptr();
1942 assert (t6Obj != 0);
1943
1944 extract <object> ev3i (mainNamespace ["v3i"]);
1945 assert (ev3i.check());
1946
1947 PyObject *v3iObj = ev3i().ptr();
1948 assert (v3iObj != 0);

Callers

nothing calls this directly

Calls 1

equalWithAbsErrorMethod · 0.80

Tested by

no test coverage detected