Skip to content

Commit 0341b2f

Browse files
author
Michael Abbott
committed
fix tests on 1.0
1 parent 5f03cc4 commit 0341b2f

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

test/_fast.jl

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ using Test, AxisKeys, BenchmarkTools
44

55
A = wrapdims(rand(2,3), 11.0:12.0, [:a, :b, :c])
66

7-
# getindex
8-
@test 0 == @ballocated $A[1, 1]
9-
@test 272 >= @ballocated $A[1, :]
10-
@test (@inferred A[1, :]; true)
11-
@test (@inferred view(A, 1, :); true)
12-
13-
# getkey
14-
@test 32 >= @ballocated $A(11.0, :a)
7+
if VERSION >= v"1.1"
8+
# getindex
9+
@test 0 == @ballocated $A[1, 1]
10+
@test 272 >= @ballocated $A[1, :]
11+
@test (@inferred A[1, :]; true)
12+
@test (@inferred view(A, 1, :); true)
13+
14+
# getkey
15+
@test 32 >= @ballocated $A(11.0, :a)
16+
end
1517

1618
al_A = @ballocated view($A,1,:) # 96
1719
@test al_A == @ballocated $A(11.0,:)
@@ -25,10 +27,12 @@ using Test, AxisKeys, BenchmarkTools
2527
# with names
2628
N = wrapdims(rand(2,3), row=11.0:12.0, col=[:a, :b, :c])
2729

28-
@test 0 == @ballocated $N[1, 1]
29-
@test 0 == @ballocated $N[col=1, row=1]
30-
@test 288 >= @ballocated $N[row=1]
31-
@test (@inferred N[row=1]; true)
30+
if VERSION >= v"1.1"
31+
@test 0 == @ballocated $N[1, 1]
32+
@test 0 == @ballocated $N[col=1, row=1]
33+
@test 288 >= @ballocated $N[row=1]
34+
@test (@inferred N[row=1]; true)
35+
end
3236

3337
# extraction
3438
@test 0 == @ballocated axiskeys($N)
@@ -58,7 +62,7 @@ end
5862
@test 80 >= @ballocated KeyedArray($M, row='a':'b', col=10:10:30) # 464 >=
5963
@test 80 >= @ballocated NamedDimsArray($M, row='a':'b', col=10:10:30) # 400 >=
6064
end
61-
@ballocated wrapdims($M, row='a':'b', col=10:10:30) # 560 >=
65+
@test 560 >= @ballocated wrapdims($M, row='a':'b', col=10:10:30) # 560 >=
6266

6367
@test (@inferred KeyedArray(M, row='a':'b', col=10:10:30); true)
6468
@test (@inferred NamedDimsArray(M, row='a':'b', col=10:10:30); true)

test/_packages.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ end
6969
@testset "inverted" begin
7070

7171
K = wrapdims(rand(4,5))
72-
@test K[:, Not(4)] == K[:, vcat(1:3, 5)] == K(:, !=(4))
72+
@test K[:, Not(4)] == K[:, vcat(1:3, 5)] == K(:, Base.Fix2(!=,4))
7373
@test K[Not(1,4), :] == K[2:3, :] == K(r -> 2<=r<=3, :)
7474

7575
N = wrapdims(rand(Int8, 2,3,4), a=[:one, :two], b='α':'γ', c=31:34)
76-
@test N[b=Not(2)] == N[:,[1,3],:] == N(b=!=('β')) == N(:,['α','γ'],:)
76+
@test N[b=Not(2)] == N[:,[1,3],:] == N(b=Base.Fix2(!=,'β')) == N(:,['α','γ'],:)
7777
@test N[c=Not(2,4)] == N(c=Index[Not(2,4)])
7878

7979
end

0 commit comments

Comments
 (0)