Skip to content

Commit

Permalink
Added tests for newly defined Base methods
Browse files Browse the repository at this point in the history
  • Loading branch information
brainandforce committed Nov 4, 2024
1 parent 044e3ef commit 01bb1bc
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -406,3 +406,36 @@ end
@test Base.literal_pow(^, m, Val(2*im)) === Base.literal_pow(^, scalar(m), Val(2*im))
=#
end

@testset "Miscellaneous properties" begin
# Finiteness
@test isfinite(EvenCliffordNumber{VGA(3)}(0, 1, 2, 3))
@test !isfinite(EvenCliffordNumber{VGA(3)}(Inf, 1, 2, 3))
@test isinf(EvenCliffordNumber{VGA(3)}(Inf, 1, 2, 3))
@test !isinf(EvenCliffordNumber{VGA(3)}(0, 1, 2, 3))
# NaN presence
@test isnan(EvenCliffordNumber{VGA(3)}(NaN, 1, 2, 3))
@test !isnan(EvenCliffordNumber{VGA(3)}(0, 1, 2, 3))
# Equivalence to real values
@test isreal(one(EvenCliffordNumber{VGA(3),Int}))
@test isreal(one(EvenCliffordNumber{VGA(3),Float64}))
@test isreal(one(EvenCliffordNumber{VGA(3),Complex{Float64}}))
@test !isreal(EvenCliffordNumber{VGA(3)}(0, 1, 2, 3))
@test !isreal(EvenCliffordNumber{VGA(3)}(im, 1, 2, 3))
@test !isreal(EvenCliffordNumber{VGA(3)}(1 + 0im, 1, 2, 3))
# Equivalence to integer values
@test isinteger(zero(KVector{1,VGA(3)}))
@test isinteger(one(EvenCliffordNumber{VGA(3),Int}))
@test isinteger(one(EvenCliffordNumber{VGA(3),Float64}))
@test isinteger(one(EvenCliffordNumber{VGA(3),Complex{Float64}}))
@test !isinteger* one(EvenCliffordNumber{VGA(3),Float64}))
@test !isinteger(EvenCliffordNumber{VGA(3)}(0, 1, 2, 3))
@test !isinteger(KVector{0,VGA(3)}(1 + im))
# Even and odd values
@test iseven(KVector{0,VGA(3)}(0))
@test !iseven(KVector{0,VGA(3)}(1))
@test isodd(KVector{0,VGA(3)}(1))
@test !isodd(KVector{0,VGA(3)}(0))
@test !iseven(EvenCliffordNumber{VGA(3)}(1, 2, 3, 4))
@test !isodd(EvenCliffordNumber{VGA(3)}(1, 2, 3, 4))
end

0 comments on commit 01bb1bc

Please sign in to comment.