diff --git a/nac3standalone/demo/src/ndarray.py b/nac3standalone/demo/src/ndarray.py index 568f0625..bdfa56ad 100644 --- a/nac3standalone/demo/src/ndarray.py +++ b/nac3standalone/demo/src/ndarray.py @@ -199,6 +199,27 @@ def test_ndarray_nd_idx(): output_float64(x[1, 0]) output_float64(x[1, 1]) +def test_ndarray_subscript_assignment(): + xs = np_array([[11111.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 99999.0]]) + output_ndarray_float_2(xs) + + output_int32(np_shape(xs[1:, 1::])[0]) + output_int32(np_shape(xs[1:, 1::])[1]) + xs[1:, 1::] = 77.0 + output_ndarray_float_2(xs) + + xs[0, -1] = 88.0 + output_ndarray_float_2(xs) + + ys = np_transpose(xs)[1::-1] + ys[0] = np_array([44.0, 55.0, 66.0]) + output_ndarray_float_2(xs) + output_ndarray_float_2(ys) + + zs = np_reshape(xs, (-1,)) + zs[2:5] = np_array([1000.0, 2000.0, 3000.0]) + output_ndarray_float_2(xs) + def test_ndarray_add(): x = np_identity(2) y = x + np_ones([2, 2]) @@ -1641,6 +1662,7 @@ def run() -> int32: test_ndarray_neg_idx() test_ndarray_slices() test_ndarray_nd_idx() + test_ndarray_subscript_assignment() test_ndarray_add() test_ndarray_add_broadcast()