From 21cace2f0a9ee1495f90640b0e80f260f0cbea0c Mon Sep 17 00:00:00 2001
From: Martin Weigert <mweigert@mpi-cbg.de>
Date: Tue, 12 Feb 2019 13:40:42 +0100
Subject: [PATCH] Added test

---
 test/test_array.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/test/test_array.py b/test/test_array.py
index 02e43e24..f27ca06d 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")
-- 
GitLab