From da6255e30e94f83636c26012e52e3db6ecf188c6 Mon Sep 17 00:00:00 2001 From: jim19930609 Date: Thu, 1 Jun 2023 09:15:01 +0800 Subject: [PATCH] bug fix --- tests/python/test_continue.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/python/test_continue.py b/tests/python/test_continue.py index cdb13d54cd73a..a837112703809 100644 --- a/tests/python/test_continue.py +++ b/tests/python/test_continue.py @@ -147,3 +147,26 @@ def run(a: ti.i32): assert x[0] == 1 run(0) assert x[0] == 0 + + +@test_utils.test() +def test_kernel_continue_in_simple_if(): + img = ti.field(ti.i32, (2, 2)) + + @ti.kernel + def K(): + for i, j in img: + img[i, j] = 0 + if i > 0 or j > 0: + continue + img[i, j] = 1 + + img.fill(2) + K() + + for i in range(2): + for j in range(2): + if i > 0 or j > 0: + assert img[i, j] == 0 + else: + assert img[i, j] == 1