Skip to content

Commit 9813aca

Browse files
committed
Add tests
1 parent 38139a6 commit 9813aca

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/core.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
A = AxisArray(reshape(1:24, 2,3,4), .1:.1:.2, .1:.1:.3, .1:.1:.4)
1+
A = @inferred(AxisArray(reshape(1:24, 2,3,4), .1:.1:.2, .1:.1:.3, .1:.1:.4))
22
@test_throws ArgumentError AxisArray(reshape(1:24, 2,3,4), .1:.1:.1, .1:.1:.3, .1:.1:.4)
33
@test_throws ArgumentError AxisArray(reshape(1:24, 2,3,4), .1:.1:.1, .1:.1:.3)
44
@test parent(A) === reshape(1:24, 2,3,4)
@@ -40,7 +40,7 @@ for perm in ((:col, :row, :page), (:col, :page, :row),
4040
end
4141
@test axisnames(permutedims(A, (:col,))) == (:col, :row, :page)
4242
@test axisnames(permutedims(A, (:page,))) == (:page, :row, :col)
43-
A2 = AxisArray(reshape(1:15, 3, 5))
43+
A2 = @inferred(AxisArray(reshape(1:15, 3, 5)))
4444
A1 = AxisArray(1:5, :t)
4545
for f in (transpose, ctranspose)
4646
@test f(A2).data == f(A2.data)
@@ -100,12 +100,12 @@ A = AxisArray([1 3; 2 4], :a)
100100
VERSION >= v"0.5.0-dev" && @inferred(axisnames(A))
101101
@test axisvalues(A) == (1:2, 1:2)
102102
# Just axis values
103-
A = AxisArray(1:3, .1:.1:.3)
103+
A = @inferred(AxisArray(1:3, .1:.1:.3))
104104
@test A.data == 1:3
105105
@test axisnames(A) == (:row,)
106106
VERSION >= v"0.5.0-dev" && @inferred(axisnames(A))
107107
@test axisvalues(A) == (.1:.1:.3,)
108-
A = AxisArray(reshape(1:16, 2,2,2,2), .5:.5:1)
108+
A = @inferred(AxisArray(reshape(1:16, 2,2,2,2), .5:.5:1))
109109
@test A.data == reshape(1:16, 2,2,2,2)
110110
@test axisnames(A) == (:row,:col,:page,:dim_4)
111111
VERSION >= v"0.5.0-dev" && @inferred(axisnames(A))
@@ -135,10 +135,10 @@ B = AxisArray([1 4; 2 5; 3 6], (:x, :y), (0.2, 100), (-3,14))
135135
Axis{2}(1//10:1//10:3//10),
136136
Axis{3}(["a", "b", "c", "d"])) # Axis need to be symbols
137137

138-
A = AxisArray(reshape(1:24, 2,3,4),
138+
A = @inferred(AxisArray(reshape(1:24, 2,3,4),
139139
Axis{:x}(.1:.1:.2),
140140
Axis{:y}(1//10:1//10:3//10),
141-
Axis{:z}(["a", "b", "c", "d"]))
141+
Axis{:z}(["a", "b", "c", "d"])))
142142

143143
@test axisdim(A, Axis{:x}) == axisdim(A, Axis{:x}()) == 1
144144
@test axisdim(A, Axis{:y}) == axisdim(A, Axis{:y}()) == 2
@@ -176,7 +176,7 @@ T = A[AxisArrays.Axis{:x}]
176176

177177
# Test Timetype axis construction
178178
dt, vals = DateTime(2010, 1, 2, 3, 40), randn(5,2)
179-
A = AxisArray(vals, Axis{:Timestamp}(dt-Dates.Hour(2):Dates.Hour(1):dt+Dates.Hour(2)), Axis{:Cols}([:A, :B]))
179+
A = @inferred(AxisArray(vals, Axis{:Timestamp}(dt-Dates.Hour(2):Dates.Hour(1):dt+Dates.Hour(2)), Axis{:Cols}([:A, :B])))
180180
@test A[:, :A].data == vals[:, 1]
181181
@test A[dt, :].data == vals[3, :]
182182

@@ -229,7 +229,7 @@ map!(*, A2, A, A)
229229

230230
# Reductions (issue #55)
231231
A = AxisArray(collect(reshape(1:15,3,5)), :y, :x)
232-
B = AxisArray(collect(reshape(1:15,3,5)), Axis{:y}(0.1:0.1:0.3), Axis{:x}(10:10:50))
232+
B = @inferred(AxisArray(collect(reshape(1:15,3,5)), Axis{:y}(0.1:0.1:0.3), Axis{:x}(10:10:50)))
233233
for C in (A, B)
234234
for op in (sum, minimum) # together, cover both reduced_indices and reduced_indices0
235235
axv = axisvalues(C)

0 commit comments

Comments
 (0)