Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
lin-hitonami committed Oct 30, 2023
1 parent 309be04 commit 7a8b410
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/python/test_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,18 @@ def my_cast(x: ti.f32) -> ti.u32:
return ti.cast(y, ti.u32)

assert my_cast(-1) == 4294967295

@test_utils.test()
def test_negative_exp():
@ti.dataclass
class Particle:
epsilon: ti.f64

@ti.kernel
def test()->ti.f64:
p1 = Particle()
p1.epsilon = 1.
e = p1.epsilon
return e ** -1

assert test() == 1.

0 comments on commit 7a8b410

Please sign in to comment.