Skip to content

Commit

Permalink
Merge pull request #36 from karlwessel/readdtests #20
Browse files Browse the repository at this point in the history
readded excluded tests since issue #20 is solved now
  • Loading branch information
chakravala committed Oct 16, 2019
2 parents 315d3b4 + 17091a2 commit 7f3c344
Showing 1 changed file with 29 additions and 35 deletions.
64 changes: 29 additions & 35 deletions test/generictests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,45 @@ using LinearAlgebra
# since they are no general mathematical properties of an GA
@testset "Test isapprox" begin
basis"2"

# basis
@test v v
@test v1 v1
@test v v
@test v1 v1
@test v2 v2
@test v12 v12
# S/MBlade
@test 2v 2v
@test 2v1 2v1
@test 2v 2v
@test 2v1 2v1
# chain
@test v1 + v2 v1 + v2
# multivector
@test v + v2 v + v2
@test v + v12 v + v12
@test v + v2 + v12 v + v2 + v12

# basis and others
@test !(v v1)
@test !(v v12)
@test !(v v1+v2)
@test !(v v1+v)
@test !(v v1+v12)
@test !(v v+v1+v12)

# S/MBlade and others
@test !(2v v1)
@test !(2v v12)
@test !(2v v1+v2)
@test !(2v v1+v)
@test !(2v v1+v12)
@test !(2v v+v1+v12)

# Chain and others
@test !(v1 + v2 v1)
@test !(v1 + v2 v12)
@test !(v1 + v2 v1+v)
@test !(v1 + v2 v1+v12)
@test !(v1 + v2 v+v1+v12)

# multivector and others
@test !(v+v1+v12 v1)
@test !(v+v1+v12 v12)
Expand All @@ -72,10 +72,8 @@ for 𝔽 in [Float64]
e = one(𝔽)
α = rand(𝔽)
@test α*e == α
@testset "Field: $(𝔽)" begin
for G in [V"+++", S"∞+", S"∅+", V"-+++",
S"∞∅+" # is currently broken for associativity
]
@testset "Field: $(𝔽)" begin
for G in [V"+++", S"∞+", S"∅+", V"-+++", S"∞∅+"]
@testset "Algebra: $(G)" begin
dims = ndims(G)

Expand All @@ -91,7 +89,7 @@ for 𝔽 in [Float64]
vectors = Any[basisvecs...]
push!(vectors, B)

# test set of multivectors
# test set of multivectors
a = rand(𝔽, 2^dims)
A = sum(a.*basis)
multivectors = Any[basis...]
Expand All @@ -102,33 +100,29 @@ for 𝔽 in [Float64]
for A in multivectors
@test e*A == A == A*e
end
end
end

@testset "a² ∈ 𝔽" begin
for a in vectors
@test a^2 scalar(a^2)*basis[1]
end
end

# currently fails for S"∞∅+"
if G != S"∞∅+"
@testset "Associativity" begin
for A in multivectors,
B in multivectors,
C in multivectors

@test (A*(B*C)) ((A*B)*C)
end
end

@testset "Associativity" begin
for A in multivectors,
B in multivectors,
C in multivectors

@test (A*(B*C)) ((A*B)*C)
end
end

@testset "Distributivity" begin
for A in multivectors,
B in multivectors,
C in multivectors

# currently fails for S"∞∅+"
@testset "Distributivity" begin
for A in multivectors,
B in multivectors,
C in multivectors

@test A*(B + C) (A*B) + (A*C)
end
@test A*(B + C) (A*B) + (A*C)
end
end

Expand Down

0 comments on commit 7f3c344

Please sign in to comment.