Skip to content

Commit 7d7996b

Browse files
committed
tests for is/left/rightunitspace
1 parent a548b36 commit 7d7996b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/symmetries/spaces.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ end
8787
@test @constinferred(axes(V)) == Base.OneTo(d)
8888
@test^d == ℝ[](d) == CartesianSpace(d) == typeof(V)(d)
8989
W = @constinferred^1
90+
@test @constinferred(isunitspace(W))
9091
@test @constinferred(unitspace(V)) == W == unitspace(typeof(V))
92+
@test @constinferred(leftunitspace(V)) == W == @constinferred(rightunitspace(V))
9193
@test @constinferred(zerospace(V)) ==^0 == zerospace(typeof(V))
9294
@test @constinferred((V, zerospace(V))) == V
9395
@test @constinferred((V, V)) ==^(2d)
@@ -133,7 +135,9 @@ end
133135
@test @constinferred(axes(V)) == Base.OneTo(d)
134136
@test^d == Vect[Trivial](d) == Vect[](Trivial() => d) == ℂ[](d) == typeof(V)(d)
135137
W = @constinferred^1
138+
@test @constinferred(isunitspace(W))
136139
@test @constinferred(unitspace(V)) == W == unitspace(typeof(V))
140+
@test @constinferred(leftunitspace(V)) == W == @constinferred(rightunitspace(V))
137141
@test @constinferred(zerospace(V)) ==^0 == zerospace(typeof(V))
138142
@test @constinferred((V, zerospace(V))) == V
139143
@test @constinferred((V, V)) ==^(2d)
@@ -228,7 +232,14 @@ end
228232
randunit = rand(collect(allunits(I)))
229233
@test_throws ArgumentError("Sector $(randunit) appears multiple times") GradedSpace(randunit => 1, randunit => 3)
230234

235+
@test isunitspace(W)
231236
@test @constinferred(unitspace(V)) == W == unitspace(typeof(V))
237+
if isa(UnitStyle(I), SimpleUnit)
238+
@test @constinferred(leftunitspace(V)) == W == @constinferred(rightunitspace(V))
239+
else
240+
@test_throws ArgumentError leftunitspace(V)
241+
@test_throws ArgumentError rightunitspace(V)
242+
end
232243
@test eval_show(W) == W
233244
@test isa(V, VectorSpace)
234245
@test isa(V, ElementarySpace)

0 commit comments

Comments
 (0)