1712.07167/test/runtests.jl

109 lines
2.5 KiB
Julia
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Test
using PropertyT
include("../src/SpNs.jl")
using .SpNs
using .SpNs.Roots
@testset "Roots" begin
@test Root((2,1)) isa Root
r = Root((2,1))
@test -r isa Root
@test 2r isa Root
@test length(2r) == 2length(r)
@test r+r isa Root
@test length(r+r) == 2length(r)
@test r-r isa Root;
@test length(r-r) == 0.0
r = Root((1,1));
s = Root((-1,1));
@test string(Root((1,1))) == "[1.0, 1.0]: root of length 1.4142135623730951"
@test isproportional(r, r)
@test isproportional(r, -r)
@test isproportional(r, 2r)
@test isproportional(-r, 2r)
@test isproportional(r+s, -s-r)
@test isorthogonal(r, s)
@test isorthogonal(r, -s)
@test isorthogonal(r, 2s)
@test isorthogonal(-r, 2s)
@test !isorthogonal(r, r+s)
@test !isorthogonal(r, -r)
@test !isorthogonal(r+s, 2s)
@test !isorthogonal(-r, 2s+r)
@test isorthogonal(r+s, -s+r)
N = 3
@test length(Roots.E(N, 1) - Roots.E(N,2)) == sqrt(2)
end
@testset "Symplectic Generators" begin
s = Sp{2}(:a, 1, 2)
@test -s isa Sp
@test inv(s) isa Sp
t = Sp{2}(:b, 1, 2)
@test -t isa Sp
@test inv(t) isa Sp
@test isproportional(s, -s)
@test isproportional(s, -s)
@test isproportional(s, inv(s))
@test isproportional(t, -t)
@test isproportional(t, inv(t))
@test !isproportional(s, t)
@test !isproportional(inv(s), -t)
end
@testset "Symplectic Group" begin
@testset "Symplectic Root System" begin
rs = SpNs.gens_roots(2)
S = [r.matrix for r in rs];
@test all(SpNs.issymplectic.(S))
@test length(S) == 16
rs = SpNs.gens_roots(3)
S = [r.matrix for r in rs];
@test all(SpNs.issymplectic.(S))
@test length(S) == 36
end
@testset "Sp(4,Z)" begin
N = 2
root_system = SpNs.gens_roots(N)
S = [g.matrix for g in root_system]
Δ = PropertyT.Laplacian(S, 2)
RG = parent(Δ)
Δs = SpNs.laplacians(RG, root_system)
@test sum(Δα for (α, Δα) in Δs) == Δ
@testset "Orthogonality & commutation" begin
r = Root([2, 0])
s = Root([0, 2])
a = Δs[r]
b = Δs[s]
@test a*b == b*a
end
Sq = sum( Δα^2 for (α, Δα) in Δs );
Adj = sum( Δα * sum(Δβ for (β, Δβ) in Δs if !isproportional(α, β)) for (α, Δα) in Δs );
@test Sq + Adj == Δ^2
end
end