Skip to content

Commit

Permalink
test: add slicing test for CPU and GPU in test_3140_cuda_slicing.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ianna authored Sep 18, 2024
1 parent bb9d111 commit 1b826c9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests-cuda/test_3140_cuda_slicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,3 +677,21 @@ def test_0127_tomask_operation():
[None],
[6.6, None, None, 9.9],
]

arrg_cpu = ak.Array([[1, 2, 3], [0], [4, 5]])
arrg_gpu = ak.Array([[1, 2, 3], [0], [4, 5]], backend="cuda")

def test_simple_slice_cpu():
print("slice on CPU")
out = arrg_cpu[:, 0]
expected = [1, 0, 4]
result = out.tolist()
cp.testing.assert_array_list_equal(result, expected, err_msg=f"Slice of [[1, 2, 3], [0], [4, 5]] should be {expected}, but got {result}")


def test_simple_slice_gpu():
print("slice on GPU")
out = arrg_gpu[:, 0]
expected = [1, 0, 4]
result = out.tolist()
cp.testing.assert_array_list_equal(result, expected, err_msg=f"Slice of [[1, 2, 3], [0], [4, 5]] should be {expected}, but got {result}")

0 comments on commit 1b826c9

Please sign in to comment.