Skip to content

Commit

Permalink
test more comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
ogauthe committed Oct 22, 2024
1 parent 435f775 commit beba332
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
4 changes: 2 additions & 2 deletions NDTensors/src/lib/SymmetrySectors/test/test_fusion_rules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using NDTensors.SymmetrySectors:
trivial
using Test: @inferred, @test, @testset, @test_throws

@testset "Simple object fusion rules" begin
@testset "Simple SymmetrySector fusion rules" begin
@testset "Z{2} fusion rules" begin
z0 = Z{2}(0)
z1 = Z{2}(1)
Expand Down Expand Up @@ -127,7 +127,7 @@ using Test: @inferred, @test, @testset, @test_throws
@test (@inferred quantum_dimension σ)) == 2.0
end
end
@testset "Reducible object fusion rules" begin
@testset "Gradedrange fusion rules" begin
@testset "Trivial GradedUnitRange" begin
g1 = gradedrange([U1(0) => 1])
g2 = gradedrange([SU2(0) => 1])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ end
end
end

@testset "Empty category" begin
@testset "Empty SymmetrySector" begin
for s in (SectorProduct(()), SectorProduct((;)))
@test s == TrivialSector()
@test s == SectorProduct(())
Expand Down
29 changes: 23 additions & 6 deletions NDTensors/src/lib/SymmetrySectors/test/test_simple_sectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ using NDTensors.SymmetrySectors:
istrivial,
trivial
using Test: @inferred, @test, @testset, @test_throws
@testset "Test Category Types" begin
@testset "Test SymmetrySectors Types" begin
@testset "TrivialSector" begin
q = TrivialSector()

Expand All @@ -40,12 +40,15 @@ using Test: @inferred, @test, @testset, @test_throws
@test trivial(q1) == U1(0)
@test trivial(U1) == U1(0)
@test istrivial(U1(0))
@test U1(0) == TrivialSector()
@test TrivialSector() == U1(0)

@test dual(U1(2)) == U1(-2)
@test isless(U1(1), U1(2))
@test !isless(U1(2), U1(1))

@test U1(0) == TrivialSector()
@test TrivialSector() == U1(0)
@test U1(-1) < TrivialSector()
@test TrivialSector() < U1(1)
end

@testset "Z₂" begin
Expand All @@ -54,7 +57,6 @@ using Test: @inferred, @test, @testset, @test_throws

@test trivial(Z{2}) == Z{2}(0)
@test istrivial(Z{2}(0))
@test Z{2}(0) == TrivialSector()

@test quantum_dimension(z0) == 1
@test quantum_dimension(z1) == 1
Expand All @@ -66,6 +68,9 @@ using Test: @inferred, @test, @testset, @test_throws
@test dual(Z{2}(1)) == Z{2}(1)
@test isless(Z{2}(0), Z{2}(1))
@test !isless(Z{2}(1), Z{2}(0))

@test Z{2}(0) == TrivialSector()
@test TrivialSector() < Z{2}(1)
end

@testset "O(2)" begin
Expand All @@ -76,7 +81,6 @@ using Test: @inferred, @test, @testset, @test_throws

@test trivial(O2) == s0e
@test istrivial(s0e)
@test s0e == TrivialSector()

@test (@inferred quantum_dimension(s0e)) == 1
@test (@inferred quantum_dimension(s0o)) == 1
Expand All @@ -87,6 +91,11 @@ using Test: @inferred, @test, @testset, @test_throws
@test (@inferred dual(s0o)) == s0o
@test (@inferred dual(s12)) == s12
@test (@inferred dual(s1)) == s1

@test s0o < s0e < s12 < s1
@test s0e == TrivialSector()
@test s0o < TrivialSector()
@test TrivialSector() < s12
end

@testset "SU(2)" begin
Expand All @@ -107,7 +116,6 @@ using Test: @inferred, @test, @testset, @test_throws

@test trivial(SU{2}) == SU2(0)
@test istrivial(SU2(0))
@test SU2(0) == TrivialSector()

@test fundamental(SU{2}) == SU2(1//2)
@test adjoint(SU{2}) == SU2(1)
Expand All @@ -122,6 +130,11 @@ using Test: @inferred, @test, @testset, @test_throws
@test dual(j2) == j2
@test dual(j3) == j3
@test dual(j4) == j4

@test j1 < j2 < j3 < j4
@test SU2(0) == TrivialSector()
@test !(j2 < TrivialSector())
@test TrivialSector() < j2
end

@testset "SU(N)" begin
Expand Down Expand Up @@ -171,6 +184,8 @@ using Test: @inferred, @test, @testset, @test_throws

@test (@inferred quantum_dimension(ı)) == 1.0
@test (@inferred quantum_dimension(τ)) == ((1 + 5) / 2)

@test ı < τ
end

@testset "Ising" begin
Expand All @@ -189,6 +204,8 @@ using Test: @inferred, @test, @testset, @test_throws
@test (@inferred quantum_dimension(ı)) == 1.0
@test (@inferred quantum_dimension(σ)) == 2
@test (@inferred quantum_dimension(ψ)) == 1.0

@test ı < σ < ψ
end
end
end

0 comments on commit beba332

Please sign in to comment.