Skip to content

Commit

Permalink
test: update codegen tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Jan 13, 2025
1 parent bf23a1d commit da3bd6d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/code.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,18 @@ nanmath_st.rewrites[:nanmath] = true

@test toexpr(a^2) == :($(^)(a, 2))
@test toexpr(a^2, nanmath_st) == :($(NaNMath.pow)(a, 2))
@test toexpr(NaNMath.pow(a, 2)) == :($(NaNMath.pow)(a, 2))
@test toexpr(NaNMath.pow(a, 2)) == :($(^)(a, 2))
@test toexpr(NaNMath.pow(a, 2), nanmath_st) == :($(NaNMath.pow)(a, 2))

@test toexpr(a^-1) == :($(/)(1, a))
@test toexpr(a^-1, nanmath_st) == :($(/)(1, a))
@test toexpr(NaNMath.pow(a, -1)) == :($(NaNMath.pow)(a, -1))
@test toexpr(NaNMath.pow(a, -1), nanmath_st) == :($(NaNMath.pow)(a, -1))
@test toexpr(NaNMath.pow(a, -1)) == :($(inv)(a))
@test toexpr(NaNMath.pow(a, -1), nanmath_st) == :($(inv)(a))

@test toexpr(a^-2) == :($(/)(1, $(^)(a, 2)))
@test toexpr(a^-2, nanmath_st) == :($(/)(1, $(NaNMath.pow)(a, 2)))
@test toexpr(NaNMath.pow(a, -2)) == :($(NaNMath.pow)(a, -2))
@test toexpr(NaNMath.pow(a, -2), nanmath_st) == :($(NaNMath.pow)(a, -2))
@test toexpr(NaNMath.pow(a, -2)) == :($(NaNMath.pow)($(inv)(a), 2))
@test toexpr(NaNMath.pow(a, -2), nanmath_st) == :($(NaNMath.pow)($(inv)(a), 2))

f = GlobalRef(NaNMath, :sin)
test_repr(toexpr(LiteralExpr(:(let x=1, y=2
Expand Down

0 comments on commit da3bd6d

Please sign in to comment.