Skip to content

Commit 1aa1461

Browse files
add test for bugfix of issue #68
1 parent f3ea387 commit 1aa1461

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/test_c_functions.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,25 @@ def test_ready_argument_list4():
7171
cfunc = CFunctions()
7272
cfunc.ready_argument_list([arg1])
7373

74+
def test_byte_array_arguments():
75+
arg1 = numpy.array([1, 2, 3]).astype(numpy.int8)
76+
77+
cfunc = CFunctions()
78+
79+
output = cfunc.ready_argument_list([arg1])
80+
81+
output_arg1 = numpy.ctypeslib.as_array(output[0], shape=arg1.shape)
82+
83+
assert output_arg1.dtype == 'int8'
84+
85+
assert all(output_arg1 == arg1)
86+
87+
dest = numpy.zeros_like(arg1)
88+
89+
cfunc.memcpy_dtoh(dest, output[0])
90+
91+
assert all(dest == arg1)
92+
7493

7594
@patch('kernel_tuner.c.subprocess')
7695
@patch('kernel_tuner.c.numpy.ctypeslib')

0 commit comments

Comments
 (0)