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

Function testRandom

src/python/PyImathTest/main.cpp:1854–1888  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1852
1853
1854void
1855testRandom ()
1856{
1857 object mainModule ((handle<> (borrowed (PyImport_AddModule ("__main__")))));
1858 object mainNamespace = mainModule.attr ("__dict__");
1859
1860 std::cerr << "Testing Random*:\n";
1861
1862 std::string code =
1863 "from imath import *\n"
1864 "from wrap import *\n"
1865 "w = wrap ('Rand32')\n"
1866 "r1 = w.nextf()\n"
1867 "r2 = w.nextf()\n"
1868 "assert r1 != r2\n"
1869 "w = wrap ('Rand48')\n"
1870 "r1 = w.nextf()\n"
1871 "r2 = w.nextf()\n"
1872 "assert r1 != r2\n";
1873
1874 handle<> ignored (PyRun_String (code.c_str(), Py_file_input,
1875 mainNamespace.ptr(), mainNamespace.ptr()));
1876
1877 //
1878
1879 std::cerr << "Testing Rand32:\n";
1880
1881 std::cerr << "ok\n";
1882
1883 //
1884
1885 std::cerr << "Testing Rand48:\n";
1886
1887 std::cerr << "ok\n";
1888}
1889
1890
1891void

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected