@@ -542,58 +542,58 @@ end
542542end
543543
544544@testset " Empty category" begin
545- s = TrivialSector ( )
546- @test s == s
547- @test ( @inferred dual (s)) == s
548- @test (@inferred s × s ) == s
549- @test (@inferred s ⊗ s) == s
550- @test (@inferred quantum_dimension (s)) == 1
551- @test (@inferred_latest trivial (s)) == s
552- @test typeof (s) == typeof ( CategoryProduct (()))
553- @test typeof (s) == typeof ( CategoryProduct ((;))) # empty NamedTuple is cast to Tuple{}
554-
555- g0 = gradedrange ([s => 2 ] )
556- @test space_isequal (( @inferred fusion_product (g0, g0)), gradedrange ([s => 4 ]))
557-
558- @test (@inferred s × U1 (1 )) == CategoryProduct (U1 (1 ))
559- @test (@inferred s × CategoryProduct (U1 (1 ))) == CategoryProduct (U1 (1 ))
560- @test (@inferred s × CategoryProduct (; A = U1 (1 ))) == CategoryProduct (; A = U1 (1 ))
561- @test (@inferred U1 (1 ) × s) == CategoryProduct (U1 (1 ))
562- @test (@inferred CategoryProduct (U1 (1 )) × s) == CategoryProduct (U1 (1 ))
563- @test ( @inferred CategoryProduct (; A = U1 ( 1 )) × s) == CategoryProduct (; A = U1 ( 1 ))
564-
565- # Empty acts as trivial
566- @test (@inferred_latest U1 ( 1 ) ⊗ s) == U1 ( 1 )
567- @test (@inferred SU2 ( 0 ) ⊗ s) == gradedrange ([SU2 ( 0 ) => 1 ])
568- @test (@inferred Fib ( " τ " ) ⊗ s) == gradedrange ([ Fib ( " τ " ) => 1 ] )
569- @test (@inferred_latest s ⊗ U1 ( 1 )) == U1 ( 1 )
570- @test (@inferred s ⊗ SU2 ( 0 )) == gradedrange ([SU2 ( 0 ) => 1 ])
571- @test ( @inferred s ⊗ Fib ( " τ " )) == gradedrange ([ Fib ( " τ " ) => 1 ])
572-
573- @test (@inferred_latest CategoryProduct (U1 ( 1 )) ⊗ s) == CategoryProduct ( U1 ( 1 ))
574- @test ( @inferred_latest CategoryProduct (SU2 (0 )) ⊗ s) ==
575- gradedrange ([ CategoryProduct (SU2 (0 )) => 1 ])
576- @test ( @inferred_latest CategoryProduct (Fib (" τ" ), SU2 (1 ), U1 (2 )) ⊗ s) ==
577- gradedrange ([ CategoryProduct ( Fib ( " τ " ), SU2 ( 1 ), U1 ( 2 )) => 1 ])
578-
579- @test (@inferred_latest CategoryProduct (; A= U1 ( 1 )) ⊗ s) == CategoryProduct (; A = U1 ( 1 ))
580- @test ( @inferred_latest CategoryProduct (; A= SU2 (0 )) ⊗ s) ==
581- gradedrange ([ CategoryProduct (; A= SU2 (0 )) => 1 ])
582- @test ( @inferred_latest CategoryProduct (; A= Fib (" τ" ), B= SU2 (1 ), C= U1 (2 )) ⊗ s) ==
583- gradedrange ([ CategoryProduct (; A = Fib ( " τ " ), B = SU2 ( 1 ), C = U1 ( 2 )) => 1 ])
584-
585- # Empty behaves as empty NamedTuple
586- @test s != U1 (0 )
587- @test s != CategoryProduct (U1 (0 ))
588- @test s != CategoryProduct (; A= U1 (1 ))
589- @test s == CategoryProduct (; A= U1 (0 ))
590- @test CategoryProduct (; A = U1 ( 0 )) == s
591-
592- @test ! ( s < s )
593- @test_throws ArgumentError s < CategoryProduct (U1 (0 ))
594- @test s < CategoryProduct (; A= U1 (1 ))
595- @test s > CategoryProduct (; A= U1 (- 1 ))
596- @test ! (s < CategoryProduct (; A= U1 (0 )))
597- @test ! (s > CategoryProduct (; A = U1 ( 0 )))
545+ for s in ( CategoryProduct (()), CategoryProduct ((;)) )
546+ @test s == CategoryProduct (())
547+ @test s == CategoryProduct ((;))
548+ @test (@inferred dual (s) ) == s
549+ @test (@inferred s × s) == s
550+ @test (@inferred s ⊗ s) == s
551+ @test (@inferred quantum_dimension (s)) == 1
552+ @test ( @inferred_latest trivial (s)) == s
553+
554+ g0 = gradedrange ([s => 2 ])
555+ @test space_isequal (( @inferred fusion_product (g0, g0)), gradedrange ([s => 4 ]) )
556+
557+ @test ( @inferred s × U1 ( 1 )) == CategoryProduct ( U1 ( 1 ))
558+ @test (@inferred s × CategoryProduct ( U1 (1 ) )) == CategoryProduct (U1 (1 ))
559+ @test (@inferred s × CategoryProduct (; A = U1 (1 ))) == CategoryProduct (; A = U1 (1 ))
560+ @test (@inferred U1 (1 ) × s) == CategoryProduct (U1 (1 ))
561+ @test (@inferred CategoryProduct ( U1 (1 ) ) × s) == CategoryProduct (U1 (1 ))
562+ @test (@inferred CategoryProduct (; A = U1 (1 )) × s) == CategoryProduct (; A = U1 (1 ))
563+
564+ # Empty acts as trivial
565+ @test ( @inferred_latest U1 ( 1 ) ⊗ s) == U1 ( 1 )
566+ @test (@inferred SU2 ( 0 ) ⊗ s) == gradedrange ([ SU2 ( 0 ) => 1 ] )
567+ @test (@inferred Fib ( " τ " ) ⊗ s) == gradedrange ([Fib ( " τ " ) => 1 ])
568+ @test (@inferred_latest s ⊗ U1 ( 1 )) == U1 ( 1 )
569+ @test (@inferred s ⊗ SU2 ( 0 )) == gradedrange ([ SU2 ( 0 ) => 1 ] )
570+ @test (@inferred s ⊗ Fib ( " τ " )) == gradedrange ([Fib ( " τ " ) => 1 ])
571+
572+ @test ( @inferred_latest CategoryProduct ( U1 ( 1 )) ⊗ s) == CategoryProduct ( U1 ( 1 ))
573+ @test (@inferred_latest CategoryProduct (SU2 ( 0 )) ⊗ s) ==
574+ gradedrange ([ CategoryProduct (SU2 (0 )) => 1 ])
575+ @test ( @inferred_latest CategoryProduct (Fib ( " τ " ), SU2 (1 ), U1 ( 2 )) ⊗ s) ==
576+ gradedrange ([ CategoryProduct (Fib (" τ" ), SU2 (1 ), U1 (2 )) => 1 ])
577+
578+ @test ( @inferred_latest CategoryProduct (; A = U1 ( 1 )) ⊗ s) == CategoryProduct (; A = U1 ( 1 ))
579+ @test (@inferred_latest CategoryProduct (; A= SU2 ( 0 )) ⊗ s) ==
580+ gradedrange ([ CategoryProduct (; A= SU2 (0 )) => 1 ])
581+ @test ( @inferred_latest CategoryProduct (; A= Fib ( " τ " ), B = SU2 (1 ), C = U1 ( 2 )) ⊗ s) ==
582+ gradedrange ([ CategoryProduct (; A= Fib (" τ" ), B= SU2 (1 ), C= U1 (2 )) => 1 ])
583+
584+ # Empty behaves as empty NamedTuple
585+ @test s != U1 ( 0 )
586+ @test s != CategoryProduct ( U1 (0 ) )
587+ @test s != CategoryProduct (; A = U1 (1 ))
588+ @test s == CategoryProduct (; A= U1 (0 ))
589+ @test CategoryProduct (; A= U1 (0 )) == s
590+
591+ @test ! (s < s)
592+ @test_throws ArgumentError s < CategoryProduct ( U1 ( 0 ) )
593+ @test s < CategoryProduct (; A = U1 (1 ))
594+ @test s > CategoryProduct (; A= U1 (- 1 ))
595+ @test ! (s < CategoryProduct (; A= U1 (0 ) ))
596+ @test ! (s > CategoryProduct (; A= U1 (0 )))
597+ end
598598end
599599end
0 commit comments