Skip to content

Commit a36f4d7

Browse files
committed
assert issorted
1 parent b4380b0 commit a36f4d7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

NDTensors/src/lib/Sectors/src/category_product.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ function categories_trivial(type::Type{<:NamedTuple{Keys}}) where {Keys}
265265
end
266266

267267
function categories_common(nt1::NamedTuple, nt2::NamedTuple)
268+
# CategoryProduct(nt::NamedTuple) sorts keys at init
269+
@assert issorted(keys(nt1))
270+
@assert issorted(keys(nt2))
268271
return intersect_keys(nt1, nt2), intersect_keys(nt2, nt1)
269272
end
270273

NDTensors/src/lib/Sectors/test/test_category_product.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ end
294294
typeof(categories(s)), Tuple(categories(s))
295295
)) == s
296296
@test (@inferred recover_category_product_type(typeof(s), Tuple(categories(s)))) == s
297+
@test s == (B=SU2(2),) × (A=U1(1),)
297298

298299
s = s × (C=Ising("ψ"),)
299300
@test length(categories(s)) == 3

0 commit comments

Comments
 (0)