Skip to content

Commit 8901076

Browse files
committed
enforce U1(Int32(1)) == U1(1)
1 parent 3f05a81 commit 8901076

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

NDTensors/src/lib/SymmetrySectors/src/sector_definitions/u1.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ abelian_label_fusion_rule(sector_type::Type{<:U1}, n1, n2) = sector_type(n1 + n2
2525
function Base.show(io::IO, u::U1)
2626
return print(io, "U(1)[", sector_label(u), "]")
2727
end
28+
29+
# enforce U1(Int32(1)) == U1(1)
30+
Base.:(==)(s1::U1, s2::U1) = sector_label(s1) == sector_label(s2)

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ using Test: @inferred, @test, @testset, @test_throws
4343
@test dual(U1(2)) == U1(-2)
4444
@test isless(U1(1), U1(2))
4545
@test !isless(U1(2), U1(1))
46+
@test U1(Int8(1)) == U1(1)
47+
@test U1(UInt32(1)) == U1(1)
4648

4749
@test U1(0) == TrivialSector()
4850
@test TrivialSector() == U1(0)
@@ -70,6 +72,9 @@ using Test: @inferred, @test, @testset, @test_throws
7072

7173
@test Z{2}(0) == TrivialSector()
7274
@test TrivialSector() < Z{2}(1)
75+
@test Z{2}(0) != Z{2}(1)
76+
@test Z{2}(0) != Z{3}(0)
77+
@test Z{2}(0) != U1(0)
7378
end
7479

7580
@testset "O(2)" begin

0 commit comments

Comments
 (0)