Skip to content
Snippets Groups Projects
Commit 511e3ad5 authored by Matt Wala's avatar Matt Wala
Browse files

Add a test for Array.copy().

parent f3d09ecf
No related branches found
No related tags found
1 merge request!16Array.copy(): Also set the queue of the new array.
...@@ -762,6 +762,32 @@ def test_diff(ctx_factory): ...@@ -762,6 +762,32 @@ def test_diff(ctx_factory):
(cl.array.diff(a_dev).get() - np.diff(a))) (cl.array.diff(a_dev).get() - np.diff(a)))
assert err < 1e-4 assert err < 1e-4
def test_copy(ctx_factory):
context = ctx_factory()
queue1 = cl.CommandQueue(context)
queue2 = cl.CommandQueue(context)
# Test copy
arr = cl.array.zeros(queue1, 100, np.int32)
arr_copy = arr.copy()
assert (arr == arr_copy).all().get()
assert arr.data != arr_copy.data
# Test queue association
arr_copy = arr.copy(queue=queue2)
assert arr_copy.queue == queue2
arr_copy = arr.copy(queue=None)
assert arr_copy.queue == None
arr_copy = arr.with_queue(None).copy(queue=queue1)
assert arr_copy.queue == queue1
# }}} # }}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment