Skip to content

Commit

Permalink
add func eval twice test according to @yuanming-hu
Browse files Browse the repository at this point in the history
  • Loading branch information
archibate committed Jul 2, 2020
1 parent 8f3d85b commit 5fbcf16
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/python/test_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,27 @@ def func():
assert a[2] # ti.append returns 0


@ti.all_archs
def test_no_duplicate_eval_func():
a = ti.var(ti.i32, ())
b = ti.var(ti.i32, ())

@ti.func
def why_this_foo_fail(n):
return ti.atomic_add(b[None], n)

def foo(n):
return ti.atomic_add(ti.subscript(b, None), n)

@ti.kernel
def func():
a[None] = 0 <= foo(2) < 1

func()
assert a[None] == 1
assert b[None] == 2


@ti.require(ti.extension.sparse)
@ti.all_archs
def test_chain_compare():
Expand Down

0 comments on commit 5fbcf16

Please sign in to comment.