Verified Commit 2f67236b authored by Justin Carpentier's avatar Justin Carpentier
Browse files

test: fix user_type for Windows

parent aed3cef7
Pipeline #15920 failed with stage
in 16 minutes and 23 seconds
......@@ -6,13 +6,13 @@ rows = 10
cols = 20
def test(dtype):
mat = np.ones((rows,cols),dtype=dtype)
mat = np.array(np.ones((rows,cols)).astype(np.intc),dtype=dtype)
mat = np.random.rand(rows,cols).astype(dtype)
mat_copy = mat.copy()
assert (mat == mat_copy).all()
assert not (mat != mat_copy).all()
# if version.parse(np.__version__) >= version.parse("1.21.0"): # check if it fixes for new versio of NumPy
# if version.parse(np.__version__) >= version.parse("1.21.0"): # check if it fixes for new versio of NumPy
# mat.fill(mat.dtype.type(20.))
# mat_copy = mat.copy()
# assert((mat == mat_copy).all())
......@@ -20,7 +20,7 @@ def test(dtype):
mat_op = mat + mat
mat_op = mat.copy(order='F') + mat.copy(order='C')
mat_op = mat - mat
mat_op = mat * mat
mat_op = mat.dot(mat.T)
......@@ -45,7 +45,7 @@ def test_cast(from_dtype,to_dtype):
from_mat = np.zeros((rows,cols),dtype=from_dtype)
to_mat = from_mat.astype(dtype=to_dtype)
test(user_type.CustomDouble)
test_cast(user_type.CustomDouble,np.double)
......
......@@ -198,12 +198,14 @@ BOOST_PYTHON_MODULE(user_type)
eigenpy::registerCast<double,DoubleType>(true);
eigenpy::registerCast<DoubleType,int32_t>(false);
eigenpy::registerCast<int32_t,DoubleType>(true);
eigenpy::registerCast<DoubleType,int64_t>(false);
eigenpy::registerCast<int64_t,DoubleType>(true);
eigenpy::registerCast<DoubleType,long long>(false);
eigenpy::registerCast<long long,DoubleType>(true);
eigenpy::registerCast<FloatType,double>(true);
eigenpy::registerCast<double,FloatType>(false);
eigenpy::registerCast<FloatType,int64_t>(false);
eigenpy::registerCast<int64_t,FloatType>(true);
eigenpy::registerCast<FloatType,long long>(false);
eigenpy::registerCast<long long,FloatType>(true);
eigenpy::registerCast<FloatType,int32_t>(false);
eigenpy::registerCast<int32_t,FloatType>(true);
bp::implicitly_convertible<double,DoubleType>();
bp::implicitly_convertible<DoubleType,double>();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment