Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions test/sectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ using TensorKitSectors: TensorKitSectors as TKS

@testsuite "Basic properties" I -> begin
s = (randsector(I), randsector(I), randsector(I))
@test Base.eval(Main, Meta.parse(sprint(show, I))) == I
@test Base.eval(Main, Meta.parse(TensorKitSectors.type_repr(I))) == I
@test Base.eval(Main, Meta.parse(sprint(show, s[1]))) == s[1]
@test @testinferred(hash(s[1])) == hash(deepcopy(s[1]))
@test @testinferred(unit(s[1])) == @testinferred(unit(I))
@testinferred dual(s[1])
Expand Down Expand Up @@ -37,6 +34,18 @@ using TensorKitSectors: TensorKitSectors as TKS
@testinferred(⊗(s..., s...))
end

@testsuite "Show and parse" I -> begin
# test in the parent module of where the test is defined
_module = parentmodule(@__MODULE__)
_eval(x) = Base.eval(_module, x)
_sprint(x) = sprint(show, x; context = (:module => _module))
@test _eval(Meta.parse(_sprint(I))) == I
@test _eval(Meta.parse(TKS.type_repr(I))) == I
for a in smallset(I)
@test _eval(Meta.parse(_sprint(a))) == a
end
end

@testsuite "Value iterator" I -> begin
@test eltype(values(I)) == I
sprev = unit(I)
Expand Down
Loading