Skip to content

Commit 752efe0

Browse files
committed
more tests
1 parent 798bd10 commit 752efe0

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

NDTensors/src/lib/SymmetrySectors/test/test_sector_product.jl

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -542,17 +542,22 @@ end
542542
end
543543

544544
@testset "Mixing implementations" begin
545-
s1 = SectorProduct(U1(1))
546-
sA = SectorProduct(; A=U1(1))
547-
548-
@test sA != s1
549-
@test_throws ArgumentError sA < s1
550-
@test_throws ArgumentError s1 < sA
551-
@test_throws MethodError s1 sA
552-
@test_throws MethodError sA s1
545+
st1 = SectorProduct(U1(1))
546+
sA1 = SectorProduct(; A=U1(1))
547+
548+
@test sA1 != st1
549+
@test_throws ArgumentError sA1 < st1
550+
@test_throws ArgumentError st1 < sA1
551+
@test_throws MethodError st1 sA1
552+
@test_throws MethodError sA1 st1
553+
@test_throws MethodError st1 × sA1
554+
@test_throws MethodError sA1 × st1
553555
end
554556

555557
@testset "Empty SymmetrySector" begin
558+
st1 = SectorProduct(U1(1))
559+
sA1 = SectorProduct(; A=U1(1))
560+
556561
for s in (SectorProduct(()), SectorProduct((;)))
557562
@test s == TrivialSector()
558563
@test s == SectorProduct(())
@@ -566,26 +571,26 @@ end
566571
g0 = gradedrange([s => 2])
567572
@test space_isequal((@inferred fusion_product(g0, g0)), gradedrange([s => 4]))
568573

569-
@test (@inferred s × U1(1)) == SectorProduct(U1(1))
570-
@test (@inferred s × SectorProduct(U1(1))) == SectorProduct(U1(1))
571-
@test (@inferred s × SectorProduct(; A=U1(1))) == SectorProduct(; A=U1(1))
572-
@test (@inferred U1(1) × s) == SectorProduct(U1(1))
573-
@test (@inferred SectorProduct(U1(1)) × s) == SectorProduct(U1(1))
574-
@test (@inferred SectorProduct(; A=U1(1)) × s) == SectorProduct(; A=U1(1))
574+
@test (@inferred s × U1(1)) == st1
575+
@test (@inferred U1(1) × s) == st1
576+
@test (@inferred s × st1) == st1
577+
@test (@inferred st1 × s) == st1
578+
@test (@inferred s × sA1) == sA1
579+
@test (@inferred sA1 × s) == sA1
575580

576-
@test (@inferred U1(1) s) == SectorProduct(U1(1))
581+
@test (@inferred U1(1) s) == st1
582+
@test (@inferred s U1(1)) == st1
577583
@test (@inferred SU2(0) s) == gradedrange([SectorProduct(SU2(0)) => 1])
578-
@test (@inferred Fib("τ") s) == gradedrange([SectorProduct(Fib("τ")) => 1])
579-
@test (@inferred s U1(1)) == SectorProduct(U1(1))
580584
@test (@inferred s SU2(0)) == gradedrange([SectorProduct(SU2(0)) => 1])
585+
@test (@inferred Fib("τ") s) == gradedrange([SectorProduct(Fib("τ")) => 1])
581586
@test (@inferred s Fib("τ")) == gradedrange([SectorProduct(Fib("τ")) => 1])
582587

583-
@test (@inferred SectorProduct(U1(1)) s) == SectorProduct(U1(1))
588+
@test (@inferred st1 s) == st1
584589
@test (@inferred SectorProduct(SU2(0)) s) == gradedrange([SectorProduct(SU2(0)) => 1])
585590
@test (@inferred SectorProduct(Fib("τ"), SU2(1), U1(2)) s) ==
586591
gradedrange([SectorProduct(Fib("τ"), SU2(1), U1(2)) => 1])
587592

588-
@test (@inferred SectorProduct(; A=U1(1)) s) == SectorProduct(; A=U1(1))
593+
@test (@inferred sA1 s) == sA1
589594
@test (@inferred SectorProduct(; A=SU2(0)) s) ==
590595
gradedrange([SectorProduct(; A=SU2(0)) => 1])
591596
@test (@inferred SectorProduct(; A=Fib("τ"), B=SU2(1), C=U1(2)) s) ==
@@ -594,14 +599,15 @@ end
594599
# Empty behaves as empty NamedTuple
595600
@test s != U1(0)
596601
@test s == SectorProduct(U1(0))
597-
@test s != SectorProduct(; A=U1(1))
598602
@test s == SectorProduct(; A=U1(0))
599603
@test SectorProduct(; A=U1(0)) == s
604+
@test s != sA1
605+
@test s != st1
600606

601607
@test !(s < s)
602-
@test s < SectorProduct(U1(1))
608+
@test s < st1
603609
@test SectorProduct(U1(-1)) < s
604-
@test s < SectorProduct(; A=U1(1))
610+
@test s < sA1
605611
@test s > SectorProduct(; A=U1(-1))
606612
@test !(s < SectorProduct(; A=U1(0)))
607613
@test !(s > SectorProduct(; A=U1(0)))

0 commit comments

Comments
 (0)