Skip to content

Commit

Permalink
Redesigned some exponentiation tests due to Julia 1.8 discrepancy
Browse files Browse the repository at this point in the history
  • Loading branch information
brainandforce committed Jun 1, 2024
1 parent 3f1bda6 commit 9052286
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions test/operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,15 @@ end
k = KVector{1,VGA(3)}(4, 2, 0)
l = KVector{2,VGA(3)}(0, 6, 9)
# Base.literal_pow tests
@test k^-2 === inv(k) * inv(k)
@test l^-2 === inv(l) * inv(l)
if k^-2 === Base.literal_pow(^, k, Val(2)) && l^-2 === Base.literal_pow(^, l, Val(2))
# These tests break on Julia 1.8: it seems that Base.literal_pow is not invoked
@test k^-2 === inv(k) * inv(k)
@test l^-2 === inv(l) * inv(l)
else
# As a fallback, check approximate equality
@test k^-2 inv(k) * inv(k)
@test l^-2 inv(l) * inv(l)
end
@test k^-1 === inv(k)
@test l^-1 === inv(l)
@test k^0 === one(k)
Expand All @@ -191,4 +198,9 @@ end
@test l^2 isa EvenCliffordNumber
@test k^3 isa OddCliffordNumber
@test l^3 isa EvenCliffordNumber
# Base.literal_pow only works for integers, apparently, but these are defined
@test Base.literal_pow(^, k, Val(false)) === one(k)
@test Base.literal_pow(^, l, Val(false)) === one(l)
@test Base.literal_pow(^, k, Val(true)) === k
@test Base.literal_pow(^, l, Val(true)) === l
end

0 comments on commit 9052286

Please sign in to comment.