diff --git a/tests-cuda/test_3140_cuda_slicing.py b/tests-cuda/test_3140_cuda_slicing.py index 34bc28f84b..828bfe552b 100644 --- a/tests-cuda/test_3140_cuda_slicing.py +++ b/tests-cuda/test_3140_cuda_slicing.py @@ -680,8 +680,8 @@ def test_0127_tomask_operation(): def test_simple_slice_cpu(): - arrg_cpu = ak.Array([[1, 2, 3], [0], [4, 5]]) - out = arrg_cpu[:, 0] + arr = ak.Array([[1, 2, 3], [0], [4, 5]]) + out = arr[:, 0] expected = [1, 0, 4] result = out.tolist() cp.testing.assert_array_list_equal( @@ -692,8 +692,8 @@ def test_simple_slice_cpu(): def test_simple_slice_gpu(): - arrg_gpu = ak.Array([[1, 2, 3], [0], [4, 5]], backend="cuda") - out = arrg_gpu[:, 0] + arr = ak.Array([[1, 2, 3], [0], [4, 5]], backend="cuda") + out = arr[:, 0] expected = [1, 0, 4] result = out.tolist() cp.testing.assert_array_list_equal( @@ -701,3 +701,67 @@ def test_simple_slice_gpu(): expected, err_msg=f"Slice of [[1, 2, 3], [0], [4, 5]] should be {expected}, but got {result}", ) + + +def test_simple_slice_cpu1(): + arr = ak.Array([[1, 2, 3], [0], [4, 5]]) + out = arr[:,1:] + expected = [[2, 3], [], [5]] + 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_gpu1(): + arr = ak.Array([[1, 2, 3], [0], [4, 5]], backend="cuda") + out = arr[:,1:] + expected = [[2, 3], [], [5]] + 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_cpu2(): + arr = ak.Array([[1, 2, 3], [0], [4, 5]]) + out = arr[:,:1] + 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_gpu2(): + arr = ak.Array([[1, 2, 3], [0], [4, 5]], backend="cuda") + out = arr[:,:1] + 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_cpu3(): + arr = ak.Array([[1, 2, 3], [0], [4, 5]]) + out = arr[:,1::2] + expected = [[2], [], [5]] + 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_gpu3(): + arr = ak.Array([[1, 2, 3], [0], [4, 5]], backend="cuda") + out = arr[:,1::2] + expected = [[2], [], [5]] + 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_cpu4(): + arr = ak.Array([[1, 2, 3], [0], [4, 5]]) + out = arr[:,::-1] + expected = [[3, 2, 1], [0], [5, 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_gpu4(): + arr = ak.Array([[1, 2, 3], [0], [4, 5]], backend="cuda") + out = arr[:,::-1] + expected = [[3, 2, 1], [0], [5, 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}")