1+ using TensorKitSectors
2+ # @isdefined(TestSetup) || include("setup.jl")
3+ # using .TestSetup
4+ testsuite_path = joinpath (
5+ dirname (dirname (pathof (TensorKitSectors))), # TensorKitSectors root
6+ " test" , " testsuite.jl"
7+ )
8+ include (testsuite_path)
9+ using . SectorTestSuite
10+
111using MultiTensorKit
2- using TensorKitSectors, TensorKit
312using Test, TestExtras
4- using Random
5- using LinearAlgebra: LinearAlgebra
13+ # using TensorKit
14+ # using LinearAlgebra: LinearAlgebra
615
716const MTK = MultiTensorKit
8- const TK = TensorKit
9-
10- @isdefined (TestSetup) || include (" setup.jl" )
11- using . TestSetup
17+ # const TK = TensorKit
1218
1319I = A4Object
1420Istr = TensorKitSectors. type_repr (I)
@@ -17,29 +23,8 @@ r = size(I)
1723println (" ----------------------" )
1824println (" | Sector tests |" )
1925println (" ----------------------" )
20-
21- @testset " $Istr Basic type properties" verbose = true begin
22- @test eval (Meta. parse (sprint (show, I))) == I
23- @test eval (Meta. parse (TensorKitSectors. type_repr (I))) == I
24- end
25-
26- @testset " $Istr : Value iterator" begin
27- @test eltype (values (I)) == I
28- @test_throws ArgumentError unit (I)
29- sprev = I (1 , 1 , 1 ) # first in SectorValues
30- for (i, s) in enumerate (values (I))
31- @test ! isless (s, sprev) # confirm compatibility with sort order
32- @test s == @constinferred (values (I)[i])
33- @test findindex (values (I), s) == i
34- sprev = s
35- i >= 10 && break
36- end
37- @test I (1 , 1 , 1 ) == first (values (I))
38- @test (@constinferred findindex (values (I), I (1 , 1 , 1 ))) == 1
39- for s in collect (values (I))
40- @test (@constinferred values (I)[findindex (values (I), s)]) == s
41- end
42- end
26+ @info " blablablabla"
27+ SectorTestSuite. test_sector (I)
4328
4429@testset " $Istr ($i , $j ) basic properties" for i in 1 : r, j in 1 : r
4530 Cii_obs = I .(i, i, MTK. _get_dual_cache (I)[2 ][i, i])
5035
5136 if i == j
5237 @testset " Basic fusion properties" begin
53- s = rand (Cii_obs, 3 )
54- @test eval (Meta. parse (sprint (show, s[1 ]))) == s[1 ]
55- @test @constinferred (hash (s[1 ])) == hash (deepcopy (s[1 ]))
56- @test isunit (@constinferred (unit (s[1 ])))
38+ @test isunit (@testinferred (unit (c)))
5739 u = I .(i, i, MTK. _get_dual_cache (I)[1 ][i])
58- @test u == @constinferred (leftunit (u)) == @constinferred (rightunit (u)) ==
59- @constinferred (unit (u))
60- @test isunit (@constinferred (unit (s[1 ])))
61- @constinferred dual (s[1 ])
62- @test dual (s[1 ]) == I .(i, i, MTK. _get_dual_cache (I)[2 ][i, i][s[1 ]. label])
63- @constinferred dim (s[1 ])
64- @constinferred frobenius_schur_phase (s[1 ])
65- @constinferred frobenius_schur_indicator (s[1 ])
66- @constinferred Nsymbol (s... )
67- @constinferred Asymbol (s... )
68- @constinferred Bsymbol (s... )
69- F = @constinferred Fsymbol (s... , s... )
70- @test eltype (F) < : @testinferred sectorscalartype (I)
40+ @test u == @testinferred (leftunit (u)) == @testinferred (rightunit (u)) ==
41+ @testinferred (unit (u))
42+ @test isunit (@testinferred (unit (c)))
43+ @test dual (c) == I .(i, i, MTK. _get_dual_cache (I)[2 ][i, i][c. label])
7144 end
7245 else
7346 @testset " Basic module properties" begin
74- @test eval (Meta. parse (sprint (show, m))) == m
75- @test @constinferred (hash (m)) == hash (deepcopy (m))
76-
7747 @test isunit (m) == false
7848 @test isunit (mop) == false
79- @test (isunit (@constinferred (leftunit (m))) && isunit (@constinferred (rightunit (m))))
49+ @test (isunit (@testinferred (leftunit (m))) && isunit (@testinferred (rightunit (m))))
8050 @test unit (c) == leftunit (m) == rightunit (mop)
8151 @test unit (d) == rightunit (m) == leftunit (mop)
8252 @test_throws DomainError unit (m)
8353 @test_throws DomainError unit (mop)
84-
85- @constinferred dual (m)
8654 @test dual (m) == I .(j, i, MTK. _get_dual_cache (I)[2 ][i, j][m. label])
87- @test dual (dual (m)) == m
88-
89- @constinferred dim (m)
90- @constinferred frobenius_schur_phase (m)
91- @constinferred frobenius_schur_indicator (m)
92- @constinferred Bsymbol (m, mop, c)
93- @constinferred Fsymbol (mop, m, mop, mop, d, c)
9455 end
9556
9657 @testset " $Istr Fusion rules" begin
9758 argerr = ArgumentError (" invalid fusion channel" )
9859 # forbidden fusions
9960 for obs in [(c, d), (d, c), (m, m), (mop, mop), (d, m), (m, c), (mop, d), (c, mop)]
100- @test_throws AssertionError ( " a.j == b.i " ) isempty (⊗ (obs... ))
61+ @test isempty (⊗ (obs... ))
10162 @test_throws argerr Nsymbol (obs... , rand ([c, m, mop, d]))
10263 end
10364
@@ -119,12 +80,16 @@ println("-----------------------------")
11980println (" | F-symbol data tests |" )
12081println (" -----------------------------" )
12182
83+ # explicitly test everything related to F-symbols
84+ # other option is to edit smallset to sample more
12285for i in 1 : r, j in 1 : r
12386 @testset " Unitarity of $Istr F-move ($i , $j )" begin
12487 if i == j
12588 @testset " Unitarity of fusion F-move ($i , $j )" begin
12689 fusion_objects = I .(i, i, MTK. _get_dual_cache (I)[2 ][i, i])
127- @test unitarity_test (fusion_objects, fusion_objects, fusion_objects)
90+ for a in fusion_objects, b in fusion_objects, c in fusion_objects
91+ @test SectorTestSuite. F_unitarity_test (a, b, c)
92+ end
12893 end
12994 end
13095
@@ -135,31 +100,41 @@ for i in 1:r, j in 1:r
135100
136101 # C x C x M -> M or D x D x Mop -> Mop
137102 @testset " Unitarity of left module F-move ($i , $j )" begin
138- @test unitarity_test (left_fusion_objects, left_fusion_objects, mod_objects)
103+ for a in left_fusion_objects, b in left_fusion_objects, A in mod_objects
104+ @test SectorTestSuite. F_unitarity_test (a, b, A)
105+ end
139106 end
140107
141108 # M x D x D -> M or Mop x C x C -> Mop
142109 @testset " Unitarity of right module F-move ($i , $j )" begin
143- @test unitarity_test (mod_objects, right_fusion_objects, right_fusion_objects)
110+ for A in mod_objects, b in right_fusion_objects, c in right_fusion_objects
111+ @test SectorTestSuite. F_unitarity_test (A, b, c)
112+ end
144113 end
145114
146115 # C x M x D -> M or D x Mop x C -> Mop
147116 @testset " Unitarity of bimodule F-move ($i , $j )" begin
148- @test unitarity_test (left_fusion_objects, mod_objects, right_fusion_objects)
117+ for a in left_fusion_objects, A in mod_objects, α in right_fusion_objects
118+ @test SectorTestSuite. F_unitarity_test (a, A, α)
119+ end
149120 end
150121
151122 @testset " Unitarity of mixed module F-move ($i , $j ) and opposite ($j , $i )" begin
152123 modop_objects = I .(j, i, MTK. _get_dual_cache (I)[2 ][j, i])
153124
154125 # C x M x Mop -> C or D x Mop x M -> D
155- @test unitarity_test (left_fusion_objects, mod_objects, modop_objects)
156126 # M x Mop x C -> C or Mop x M x D -> D
157- @test unitarity_test (mod_objects, modop_objects, left_fusion_objects)
158127 # Mop x C x M -> D or M x D x Mop -> C
159- @test unitarity_test (modop_objects, left_fusion_objects, mod_objects)
128+ for a in left_fusion_objects, A in mod_objects, Aop in modop_objects
129+ @test SectorTestSuite. F_unitarity_test (a, A, Aop)
130+ @test SectorTestSuite. F_unitarity_test (A, Aop, a)
131+ @test SectorTestSuite. F_unitarity_test (Aop, a, A)
132+ end
160133
161134 # M x Mop x M -> M or Mop x M x Mop -> Mop
162- @test unitarity_test (mod_objects, modop_objects, mod_objects)
135+ for A in mod_objects, Aop in modop_objects
136+ @test SectorTestSuite. F_unitarity_test (A, Aop, A)
137+ end
163138 end
164139 end
165140end
0 commit comments