-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from JuliaArrays/teh/v1.0
Get package working on 0.7 and 1.0
- Loading branch information
Showing
8 changed files
with
105 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,8 @@ os: | |
- linux | ||
- osx | ||
julia: | ||
- 0.6 | ||
- 0.7 | ||
- 1.0 | ||
- nightly | ||
notifications: | ||
email: false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
julia 0.6 | ||
julia 0.7 | ||
OffsetArrays | ||
CustomUnitRanges |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
__precompile__() | ||
|
||
module CatIndices | ||
|
||
export BidirectionalVector, PinIndices, deletetail!, deletehead! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,60 @@ | ||
using CatIndices | ||
using Base.Test | ||
using Test | ||
|
||
### BidirectionalVector | ||
@testset "CatIndices" begin | ||
function checkvals(v) | ||
for i in axes(v,1) | ||
@test v[i] == i | ||
end | ||
nothing | ||
end | ||
@testset "BidirectionalVector" begin | ||
v = BidirectionalVector(1:3) | ||
@test axes(v,1) == 1:3 | ||
checkvals(v) | ||
@test isa(push!(v, 4), BidirectionalVector) | ||
@test axes(v,1) == 1:4 | ||
checkvals(v) | ||
@test isa(append!(v, 5:11), BidirectionalVector) | ||
@test axes(v,1) == 1:11 | ||
checkvals(v) | ||
@test pop!(v) == 11 | ||
@test axes(v,1) == 1:10 | ||
checkvals(v) | ||
@test isa(deletetail!(v, 2), BidirectionalVector) | ||
@test axes(v,1) == 1:8 | ||
checkvals(v) | ||
@test popfirst!(v) == 1 | ||
@test axes(v,1) == 2:8 | ||
checkvals(v) | ||
@test isa(pushfirst!(v, 0, 1), BidirectionalVector) | ||
@test isa(pushfirst!(v, -1), BidirectionalVector) | ||
@test axes(v,1) == -1:8 | ||
checkvals(v) | ||
@test isa(prepend!(v, -5:-2), BidirectionalVector) | ||
@test axes(v,1) == -5:8 | ||
checkvals(v) | ||
@test isa(deletehead!(v,2), BidirectionalVector) | ||
@test axes(v,1) == -3:8 | ||
checkvals(v) | ||
|
||
v[0] = 200 | ||
@test v[0] == 200 | ||
|
||
@test axes(similar(v)) === axes(v) | ||
@test axes(similar(v, Float64)) === axes(v) | ||
@test axes(similar(v, Float64, 3)) === (Base.OneTo(3),) | ||
a = similar(Array{Float64}, axes(v)) | ||
@test isa(a, BidirectionalVector) | ||
@test axes(a) === axes(v) | ||
end | ||
|
||
function checkvals(v) | ||
for i in indices(v,1) | ||
@test v[i] == i | ||
@testset "vcat" begin | ||
@test !CatIndices.is_pinned(1:3) | ||
@test CatIndices.is_pinned(PinIndices(1:3)) | ||
v = vcat(1:3, PinIndices(4:5), 6:10) | ||
@test axes(v,1) == -2:7 | ||
@test_throws ArgumentError vcat(1:3, PinIndices(4:5), PinIndices(6:10)) | ||
end | ||
nothing | ||
end | ||
|
||
v = BidirectionalVector(1:3) | ||
@test indices(v,1) == 1:3 | ||
checkvals(v) | ||
@test isa(push!(v, 4), BidirectionalVector) | ||
@test indices(v,1) == 1:4 | ||
checkvals(v) | ||
@test isa(append!(v, 5:11), BidirectionalVector) | ||
@test indices(v,1) == 1:11 | ||
checkvals(v) | ||
@test pop!(v) == 11 | ||
@test indices(v,1) == 1:10 | ||
checkvals(v) | ||
@test isa(deletetail!(v, 2), BidirectionalVector) | ||
@test indices(v,1) == 1:8 | ||
checkvals(v) | ||
@test shift!(v) == 1 | ||
@test indices(v,1) == 2:8 | ||
checkvals(v) | ||
@test isa(unshift!(v, 0, 1), BidirectionalVector) | ||
@test isa(unshift!(v, -1), BidirectionalVector) | ||
@test indices(v,1) == -1:8 | ||
checkvals(v) | ||
@test isa(prepend!(v, -5:-2), BidirectionalVector) | ||
@test indices(v,1) == -5:8 | ||
checkvals(v) | ||
@test isa(deletehead!(v,2), BidirectionalVector) | ||
@test indices(v,1) == -3:8 | ||
checkvals(v) | ||
|
||
v[0] = 200 | ||
@test v[0] == 200 | ||
|
||
@test indices(similar(v)) === indices(v) | ||
@test indices(similar(v, Float64)) === indices(v) | ||
@test indices(similar(v, Float64, 3)) === (Base.OneTo(3),) | ||
a = similar(Array{Float64}, indices(v)) | ||
@test isa(a, BidirectionalVector) | ||
@test indices(a) === indices(v) | ||
|
||
### vcat | ||
|
||
@test !CatIndices.is_pinned(1:3) | ||
@test CatIndices.is_pinned(PinIndices(1:3)) | ||
v = vcat(1:3, PinIndices(4:5), 6:10) | ||
@test indices(v,1) == -2:7 | ||
@test_throws ArgumentError vcat(1:3, PinIndices(4:5), PinIndices(6:10)) | ||
|
||
nothing |