-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for baseTypeLowest/Max/Smallest/Epsilon #348
Comments
Hi, If I have read the codebase correctly, And the C++ class templates methods that, return the lowest/max/smallest/epsilon values of the base type, and where these methods are binded into python, eg.
must be tested in python similar to: import imath
M44dEpsilon = imath.M44d.baseTypeEpsilon()
DBL_EPS == M44dEpsilon Is this correct? |
The python-based tests have the dual advantage of validating both the binding code and the underlying Imath functionality, so the majority of the coverage of the test suite actually comes from I noted this issue from the SonarCloud coverage analysis report: https://sonarcloud.io/component_measures?metric=uncovered_lines&view=list&id=AcademySoftwareFoundation_Imath A straightforward issue as a potential task for the ASWF Dev Days event. |
From what I see in the We have in VecBaseType = {}
VecBaseType[V2s] = int
VecBaseType[V2i] = int
VecBaseType[V2f] = float
VecBaseType[V2d] = float
VecBaseType[V3s] = int
VecBaseType[V3i] = int
VecBaseType[V3f] = float
VecBaseType[V3d] = float But, as you know, Python "float" is actually C/C++ double and we have However in the main codebase we have class methods similar to: IMATH_HOSTDEVICE constexpr static T baseTypeLowest () IMATH_NOEXCEPT
{
return std::numeric_limits<T>::lowest ();
} Where Without significant changes to possibly the entire For instance, we need to add the below code into the scope().attr("SHT_MIN") = std::numeric_limits<short>::min();
scope().attr("SHT_MAX") = std::numeric_limits<short>::max();
scope().attr("SHT_LOWEST") = std::numeric_limits<short>::lowest();
scope().attr("SHT_EPS") = std::numeric_limits<short>::epsilon();
scope().attr("I64_MIN") = std::numeric_limits<int64_t>::min();
scope().attr("I64_MAX") = std::numeric_limits<int64_t>::max();
scope().attr("I64_LOWEST") = std::numeric_limits<int64_t>::lowest();
scope().attr("I64_EPS") = std::numeric_limits<int64_t>::epsilon(); To give a concrete example why we would have to change the def testV2 ():
print ("V2i")
testV2x (V2i)
print ("V2f")
testV2x (V2f)
print ("V2d")
testV2x (V2d) But the BaseTypes defined at te start of the file means that we will have errors in testing the limits of |
Various class templates declare methods that return lowest/max/smallest/epsilon on the template base type, e.g.
These methods are not covered in the test suite. Entries should be added to the python test src/python/PyImathTest/pyImathTest.in
The text was updated successfully, but these errors were encountered: