Skip to content

Commit

Permalink
Add tests for unsupported "compare" operators (taichi-dev#547)
Browse files Browse the repository at this point in the history
* Add tests for unsupported "compare" operators

* Add tests for unsupported "compare" operators
  • Loading branch information
xumingkuan authored Feb 27, 2020
1 parent d0b227c commit e681b13
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion tests/python/test_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def func():
a[9] = c >= b
a[10] = c == b
a[11] = c != b
# a[12] = b is not c # not supported

func()
assert a[0]
Expand Down Expand Up @@ -118,3 +117,51 @@ def func():
func()
assert a[0]
assert not a[1]


@ti.must_throw(ti.TaichiSyntaxError)
def test_is():
b = ti.var(ti.i32, shape=())
c = ti.var(ti.i32, shape=())

@ti.kernel
def func():
a = b is c

func()


@ti.must_throw(ti.TaichiSyntaxError)
def test_is_not():
b = ti.var(ti.i32, shape=())
c = ti.var(ti.i32, shape=())

@ti.kernel
def func():
a = b is not c

func()


@ti.must_throw(ti.TaichiSyntaxError)
def test_in():
b = ti.var(ti.i32, shape=())
c = ti.var(ti.i32, shape=())

@ti.kernel
def func():
a = b in c

func()


@ti.must_throw(ti.TaichiSyntaxError)
def test_not_in():
b = ti.var(ti.i32, shape=())
c = ti.var(ti.i32, shape=())

@ti.kernel
def func():
a = b not in c

func()

0 comments on commit e681b13

Please sign in to comment.