Skip to content

Commit a04ee86

Browse files
committed
Add tests for ExactValue indexing
1 parent c8ff6f6 commit a04ee86

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/indexing.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,11 @@ A = AxisArray([1 2; 3 4], Axis{:x}([1.0,4.0]), Axis{:y}([2.0,6.1]))
196196
@test @inferred(A[Axis{:x}(atvalue(2.0, atol=5))]) == [1,2]
197197
@test_throws BoundsError A[Axis{:x}(atvalue(4.00000001, rtol=0))]
198198

199+
# Indexing with ExactValue on Dimensional axes
200+
A = AxisArray([2.0,4.0,6.1], Axis{:x}([-10,1,3]))
201+
@test @inferred(A[AxisArrays.ExactValue(1)]) == @inferred(A[atvalue(1)]) == 4.0
202+
@test_throws BoundsError A[AxisArrays.ExactValue(2)]
203+
199204
# Indexing by array of values
200205
A = AxisArray([1 2 3 4; 5 6 7 8; 9 10 11 12], -1:1, [5.1, 5.4, 5.7, 5.8])
201206
@test @inferred(A[atvalue(-1), atvalue.([5.1, 5.7])]) == [1, 3]

0 commit comments

Comments
 (0)