diff --git a/test/test_array.py b/test/test_array.py index 02e43e2481f4b3bdcdbc25f4c682dbd0043052b0..f27ca06d00d0881c5251a3a7fb4643edb876c57a 100644 --- a/test/test_array.py +++ b/test/test_array.py @@ -499,7 +499,25 @@ def test_divide_array(ctx_factory): a_divide = (b_gpu / a_gpu).get() assert (np.abs(b / a - a_divide) < 1e-3).all() +def test_divide_inplace_array(ctx_factory): + """Test the division of an array and a scalar. """ + + context = ctx_factory() + queue = cl.CommandQueue(context) + + for dtype in (np.uint8, np.int8, np.uint16, np.int16, np.uint32, np.int32, np.float32): + #test data + a = np.array([10, 20, 30, 40, 50, 60, 70, 80, 90, 100]).astype(np.float32) + b = np.array([10, 10, 10, 10, 10, 10, 10, 10, 10, 10]).astype(np.float32) + + a_gpu = cl_array.to_device(queue, a) + b_gpu = cl_array.to_device(queue, b) + + a_gpu /= b_gpu + a_divide = a_gpu.get() + assert (np.abs(a / b - a_divide) < 1e-3).all() + def test_bitwise(ctx_factory): if _PYPY: pytest.xfail("numpypy: missing bitwise ops")