-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathruntests.jl
More file actions
140 lines (124 loc) · 5.2 KB
/
runtests.jl
File metadata and controls
140 lines (124 loc) · 5.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
using Test
using TestExtras
using TensorKitSectors
include("newsectors.jl")
using .NewSectors
const sectorlist = (
Trivial, PlanarTrivial,
Z2Irrep, Z3Irrep, Z4Irrep, Irrep[ℤ{200}], U1Irrep,
DNIrrep{3}, DNIrrep{4}, DNIrrep{5}, CU1Irrep,
A4Irrep, SU2Irrep, NewSU2Irrep,
FibonacciAnyon, IsingAnyon, FermionParity,
FermionParity ⊠ FermionParity,
Z3Irrep ⊠ Z4Irrep, FermionParity ⊠ U1Irrep ⊠ SU2Irrep,
FermionParity ⊠ SU2Irrep ⊠ SU2Irrep, NewSU2Irrep ⊠ NewSU2Irrep,
NewSU2Irrep ⊠ SU2Irrep, FermionParity ⊠ SU2Irrep ⊠ NewSU2Irrep,
FibonacciAnyon ⊠ FibonacciAnyon ⊠ Z2Irrep,
A4Irrep ⊠ Z2Irrep, A4Irrep ⊠ SU2Irrep,
Z2Element{0}, Z2Element{1},
Z3Element{0}, Z3Element{1}, Z3Element{2},
Z4Element{0}, Z4Element{1}, Z4Element{2},
Z3Element{1} ⊠ SU2Irrep,
FibonacciAnyon ⊠ Z4Element{3},
TimeReversed{Z2Irrep},
TimeReversed{Z3Irrep}, TimeReversed{Z4Irrep}, TimeReversed{A4Irrep},
TimeReversed{U1Irrep}, TimeReversed{CU1Irrep}, TimeReversed{SU2Irrep},
TimeReversed{FibonacciAnyon}, TimeReversed{IsingAnyon},
TimeReversed{FermionParity},
TimeReversed{FermionParity ⊠ FermionParity},
TimeReversed{Z2Irrep ⊠ Z3Irrep ⊠ Z4Irrep},
TimeReversed{Z2Irrep} ⊠ TimeReversed{Z3Irrep} ⊠ TimeReversed{Z4Irrep},
TimeReversed{NewSU2Irrep ⊠ NewSU2Irrep},
TimeReversed{Z2Irrep ⊠ FibonacciAnyon ⊠ FibonacciAnyon},
TimeReversed{NewSU2Irrep ⊠ SU2Irrep},
TimeReversed{FermionParity ⊠ U1Irrep ⊠ SU2Irrep},
TimeReversed{FermionParity ⊠ SU2Irrep ⊠ SU2Irrep},
TimeReversed{FermionParity ⊠ SU2Irrep ⊠ NewSU2Irrep},
)
include("testsuite.jl")
using .SectorTestSuite
@testset "Sector test suite" verbose = true begin
for sectortype in sectorlist
@time SectorTestSuite.test_sector(sectortype)
end
end
@testset "Deligne product" begin
sectorlist′ = (Trivial, sectorlist...)
for I1 in sectorlist′, I2 in sectorlist′
a = first(smallset(I1))
b = first(smallset(I2))
@testinferred a ⊠ b
@testinferred a ⊠ b ⊠ a
@testinferred a ⊠ b ⊠ a ⊠ b
@testinferred I1 ⊠ I2
@test typeof(a ⊠ b) == I1 ⊠ I2
@test @testinferred(length(allunits(I1 ⊠ I2))) == 1
@test @testinferred(unit(I1 ⊠ I2)) == leftunit(a ⊠ b) == rightunit(a ⊠ b)
end
@test @testinferred(Tuple(SU2Irrep(1) ⊠ U1Irrep(0))) == (SU2Irrep(1), U1Irrep(0))
@test @testinferred(length(FermionParity(1) ⊠ SU2Irrep(1 // 2) ⊠ U1Irrep(1))) == 3
end
@testset "Issue that came up in #11" begin
a = Z2Irrep(1) ⊠ NewSU2Irrep(1)
b = Z2Irrep(0) ⊠ NewSU2Irrep(1)
c = Z2Irrep(0) ⊠ NewSU2Irrep(1)
d = Z2Irrep(0) ⊠ NewSU2Irrep(1)
e = Z2Irrep(0) ⊠ NewSU2Irrep(1)
f = Z2Irrep(0) ⊠ NewSU2Irrep(1)
@test size(Fsymbol(a, b, c, d, e, f)) == (0, 1, 1, 0)
@test size(Bsymbol(a, b, c)) == (0, 0)
@test size(Rsymbol(a, b, c)) == (0, 0)
a = NewSU2Irrep(1) ⊠ Z2Irrep(1)
b = NewSU2Irrep(1) ⊠ Z2Irrep(0)
c = NewSU2Irrep(1) ⊠ Z2Irrep(0)
d = NewSU2Irrep(1) ⊠ Z2Irrep(0)
e = NewSU2Irrep(1) ⊠ Z2Irrep(0)
f = NewSU2Irrep(1) ⊠ Z2Irrep(0)
@test size(Fsymbol(a, b, c, d, e, f)) == (0, 1, 1, 0)
@test size(Bsymbol(a, b, c)) == (0, 0)
@test size(Rsymbol(a, b, c)) == (0, 0)
end
@testset "Frobenius-Schur" begin
@test frobenius_schur_phase(SU2Irrep(0)) == 1.0
@test frobenius_schur_phase(SU2Irrep(1 // 2)) == -1.0
@test frobenius_schur_phase(Z2Irrep(0)) == 1.0
@test frobenius_schur_phase(Z2Irrep(1)) == 1.0
@test frobenius_schur_phase(Z3Irrep(0)) == 1.0
@test frobenius_schur_phase(Z3Irrep(1)) == 1.0
@test frobenius_schur_phase(U1Irrep(0)) == 1.0
@test frobenius_schur_phase(U1Irrep(1)) == 1.0
@test frobenius_schur_indicator(SU2Irrep(0)) == 1.0
@test frobenius_schur_indicator(SU2Irrep(1 // 2)) == -1.0
@test frobenius_schur_indicator(Z2Irrep(0)) == 1.0
@test frobenius_schur_indicator(Z2Irrep(1)) == 1.0
@test frobenius_schur_indicator(Z3Irrep(0)) == 1.0
@test frobenius_schur_indicator(Z3Irrep(1)) == 0.0
@test frobenius_schur_indicator(U1Irrep(0)) == 1.0
@test frobenius_schur_indicator(U1Irrep(1)) == 0.0
end
@testset "SectorProduct printing" begin
a = SU2Irrep(1)
@test repr(a ⊗ a) == "Irrep[SU₂](1) ⊗ Irrep[SU₂](1)"
@test repr("text/plain", a ⊗ a) == "Irrep[SU₂](1) ⊗ Irrep[SU₂](1):\n 0\n 1\n 2"
b = D4Irrep(1)
@test repr(b ⊗ b) == "Irrep[D₄](1, false) ⊗ Irrep[D₄](1, false)"
@test repr("text/plain", b ⊗ b) == "Irrep[D₄](1, false) ⊗ Irrep[D₄](1, false):\n (0, false)\n (0, true)\n (2, false)\n (2, true)"
end
@testset "ZNIrrep edge cases" begin
for N in (127, 128, 129)
a = Irrep[Cyclic{N}](-1)
@test typeof(a) == ((N ≤ (typemax(UInt8) + 1) ÷ 2) ? ZNIrrep{N} : LargeZNIrrep{N})
@test typeof(charge(a)) == Int
@test charge(dual(a)) == mod(-charge(a), N)
@test charge(only(a ⊗ a)) == mod(charge(a) + charge(a), N)
end
end
include("multifusion.jl")
@testset "Aqua" begin
using Aqua: Aqua
Aqua.test_all(TensorKitSectors)
end
@testset "JET" begin
using JET: JET
JET.test_package(TensorKitSectors; target_defined_modules = true)
end