1- Istr = TKS. type_repr (I)
2- @testset " Sector $Istr : Basic properties" begin
1+ using . TestSetup: smallset, randsector, hasfusiontensor
2+ using . SectorTestSuite: @testsuite
3+ using TensorKitSectors
4+ using TensorOperations
5+ using LinearAlgebra
6+
7+ @testsuite " Basic properties" I -> begin
38 s = (randsector (I), randsector (I), randsector (I))
4- @test eval (Meta. parse (sprint (show, I))) == I
5- @test eval (Meta. parse (TKS . type_repr (I))) == I
6- @test eval (Meta. parse (sprint (show, s[1 ]))) == s[1 ]
7- @test @constinferred (hash (s[1 ])) == hash (deepcopy (s[1 ]))
8- @test @constinferred (unit (s[1 ])) == @constinferred (unit (I))
9- @constinferred dual (s[1 ])
10- @constinferred dim (s[1 ])
11- @constinferred frobenius_schur_phase (s[1 ])
12- @constinferred frobenius_schur_indicator (s[1 ])
13- @constinferred Nsymbol (s... )
14- @constinferred Asymbol (s... )
15- B = @constinferred Bsymbol (s... )
16- F = @constinferred Fsymbol (s... , s... )
9+ @test Base . eval (Main, Meta. parse (sprint (show, I))) == I
10+ @test Base . eval (Main, Meta. parse (TensorKitSectors . type_repr (I))) == I
11+ @test Base . eval (Main, Meta. parse (sprint (show, s[1 ]))) == s[1 ]
12+ @test @testinferred (hash (s[1 ])) == hash (deepcopy (s[1 ]))
13+ @test @testinferred (unit (s[1 ])) == @testinferred (unit (I))
14+ @testinferred dual (s[1 ])
15+ @testinferred dim (s[1 ])
16+ @testinferred frobenius_schur_phase (s[1 ])
17+ @testinferred frobenius_schur_indicator (s[1 ])
18+ @testinferred Nsymbol (s... )
19+ @testinferred Asymbol (s... )
20+ B = @testinferred Bsymbol (s... )
21+ F = @testinferred Fsymbol (s... , s... )
1722 if BraidingStyle (I) isa HasBraiding
18- R = @constinferred Rsymbol (s... )
23+ R = @testinferred Rsymbol (s... )
1924 if FusionStyle (I) === SimpleFusion ()
20- @test typeof (R * F) < : @constinferred sectorscalartype (I)
25+ @test typeof (R * F) < : @testinferred sectorscalartype (I)
2126 else
22- @test Base. promote_op (* , eltype (R), eltype (F)) < : @constinferred sectorscalartype (I)
27+ @test Base. promote_op (* , eltype (R), eltype (F)) < : @testinferred sectorscalartype (I)
2328 end
2429 else
2530 if FusionStyle (I) === SimpleFusion ()
26- @test typeof (F) < : @constinferred sectorscalartype (I)
31+ @test typeof (F) < : @testinferred sectorscalartype (I)
2732 else
28- @test eltype (F) < : @constinferred sectorscalartype (I)
33+ @test eltype (F) < : @testinferred sectorscalartype (I)
2934 end
3035 end
31- it = @constinferred s[1 ] ⊗ s[2 ]
32- @constinferred ⊗ (s... , s... )
36+ @testinferred ( s[1 ] ⊗ s[2 ])
37+ @testinferred ( ⊗ (s... , s... ) )
3338end
34- @testset " Sector $Istr : Value iterator" begin
39+
40+ @testsuite " Value iterator" I -> begin
3541 @test eltype (values (I)) == I
3642 sprev = unit (I)
3743 for (i, s) in enumerate (values (I))
38- @test ! isless (s, sprev) # confirm compatibility with sort order
39- @test s == @constinferred (values (I)[i])
44+ @test ! isless (s, sprev)
45+ @test s == @testinferred (values (I)[i])
4046 @test findindex (values (I), s) == i
4147 sprev = s
4248 i >= 10 && break
4349 end
4450 @test unit (I) == first (values (I))
4551 @test length (allunits (I)) == 1
46- @test (@constinferred findindex (values (I), unit (I))) == 1
52+ @test (@testinferred findindex (values (I), unit (I))) == 1
4753 for s in smallset (I)
48- @test (@constinferred values (I)[findindex (values (I), s)]) == s
54+ @test (@testinferred values (I)[findindex (values (I), s)]) == s
4955 end
5056end
51- if BraidingStyle (I) isa Bosonic && hasfusiontensor (I)
52- @testset " Sector $Istr : fusion tensor and F-move and R-move" begin
57+
58+ @testsuite " fusion tensor and F-move and R-move" I -> begin
59+ if BraidingStyle (I) isa Bosonic && hasfusiontensor (I)
5360 for a in smallset (I), b in smallset (I)
5461 for c in ⊗ (a, b)
5562 X1 = permutedims (fusiontensor (a, b, c), (2 , 1 , 3 , 4 ))
@@ -80,8 +87,9 @@ if BraidingStyle(I) isa Bosonic && hasfusiontensor(I)
8087 end
8188 end
8289end
83- if hasfusiontensor (I)
84- @testset " Orthogonality of fusiontensors" begin
90+
91+ @testsuite " Orthogonality of fusiontensors" I -> begin
92+ if hasfusiontensor (I)
8593 for a in smallset (I), b in smallset (I)
8694 cs = vec (collect (a ⊗ b))
8795 CGCs = map (c -> reshape (fusiontensor (a, b, c), :, dim (c)), cs)
@@ -93,7 +101,7 @@ if hasfusiontensor(I)
93101 end
94102end
95103
96- @testset " Sector $Istr : Unitarity of F-move" begin
104+ @testsuite " Unitarity of F-move" I -> begin
97105 for a in smallset (I), b in smallset (I), c in smallset (I)
98106 for d in ⊗ (a, b, c)
99107 es = collect (intersect (⊗ (a, b), map (dual, ⊗ (c, dual (d)))))
@@ -105,29 +113,29 @@ end
105113 Fblocks = Vector {Any} ()
106114 for e in es, f in fs
107115 Fs = Fsymbol (a, b, c, d, e, f)
108- push! (
109- Fblocks,
110- reshape (Fs, (size (Fs, 1 ) * size (Fs, 2 ), size (Fs, 3 ) * size (Fs, 4 )))
111- )
116+ push! (Fblocks, reshape (Fs, (size (Fs, 1 ) * size (Fs, 2 ), size (Fs, 3 ) * size (Fs, 4 ))))
112117 end
113118 F = hvcat (length (fs), Fblocks... )
114119 end
115120 @test isapprox (F' * F, one (F); atol = 1.0e-12 , rtol = 1.0e-12 )
116121 end
117122 end
118123end
119- @testset " Sector $Istr : Triangle equation" begin
124+
125+ @testsuite " Triangle equation" I -> begin
120126 for a in smallset (I), b in smallset (I)
121127 @test triangle_equation (a, b; atol = 1.0e-12 , rtol = 1.0e-12 )
122128 end
123129end
124- @testset " Sector $Istr : Pentagon equation" begin
130+
131+ @testsuite " Pentagon equation" I -> begin
125132 for a in smallset (I), b in smallset (I), c in smallset (I), d in smallset (I)
126133 @test pentagon_equation (a, b, c, d; atol = 1.0e-12 , rtol = 1.0e-12 )
127134 end
128135end
129- if BraidingStyle (I) isa HasBraiding
130- @testset " Sector $Istr : Hexagon equation" begin
136+
137+ @testsuite " Hexagon equation" I -> begin
138+ if BraidingStyle (I) isa HasBraiding
131139 for a in smallset (I), b in smallset (I), c in smallset (I)
132140 @test hexagon_equation (a, b, c; atol = 1.0e-12 , rtol = 1.0e-12 )
133141 end
0 commit comments