diff --git a/.travis.yml b/.travis.yml index 1f4ade6..7471745 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,35 +1,20 @@ -## Documentation: http://docs.travis-ci.com/user/languages/julia/ +# Documentation: http://docs.travis-ci.com/user/languages/julia/ language: julia os: - linux - osx julia: - - 0.6 + - 1.0 - nightly -notifications: - email: false -git: - depth: 99999999 - -## uncomment the following lines to allow failures on nightly julia -## (tests will run but not make your overall status red) matrix: allow_failures: - - julia: nightly - -## uncomment and modify the following lines to manually install system packages -#addons: -# apt: # apt-get for linux -# packages: -# - gfortran -#before_script: # homebrew for mac -# - if [ $TRAVIS_OS_NAME = osx ]; then brew install gcc; fi - -## uncomment the following lines to override the default test script + - julia: nightly +notifications: + email: false +# uncomment the following lines to override the default test script #script: +# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi # - julia -e 'Pkg.clone(pwd()); Pkg.build("LASindex"); Pkg.test("LASindex"; coverage=true)' + after_success: - # push coverage results to Coveralls - - julia -e 'cd(Pkg.dir("LASindex")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())' - # push coverage results to Codecov - - julia -e 'cd(Pkg.dir("LASindex")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' +- julia -e 'cd(Pkg.dir("LASindex")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' diff --git a/REQUIRE b/REQUIRE index 8ce40fd..11bbfbf 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,3 +1,4 @@ -julia 0.6 -RegionTrees 0.1.0 +julia 0.7 +RegionTrees 0.2.0 FileIO +StaticArrays diff --git a/appveyor.yml b/appveyor.yml index 1a57883..9aa56ab 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,16 +1,17 @@ environment: matrix: - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe" - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" - -## uncomment the following lines to allow failures on nightly julia -## (tests will run but not make your overall status red) -matrix: - allow_failures: - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" + - julia_version: 1.0 + - julia_version: nightly + +platform: + - x86 # 32-bit + - x64 # 64-bit + +# # Uncomment the following lines to allow failures on nightly julia +# # (tests will run but not make your overall status red) +# matrix: +# allow_failures: +# - julia_version: nightly branches: only: @@ -24,24 +25,18 @@ notifications: on_build_status_changed: false install: - - ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12" -# If there's a newer build queued for the same PR, cancel this one - - ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` - https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` - Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` - throw "There are newer queued builds for this pull request, failing early." } -# Download most recent Julia Windows binary - - ps: (new-object net.webclient).DownloadFile( - $env:JULIA_URL, - "C:\projects\julia-binary.exe") -# Run installer silently, output to C:\projects\julia - - C:\projects\julia-binary.exe /S /D=C:\projects\julia + - ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1")) build_script: -# Need to convert from shallow to complete for Pkg.clone to work - - IF EXIST .git\shallow (git fetch --unshallow) - - C:\projects\julia\bin\julia -e "versioninfo(); - Pkg.clone(pwd(), \"LASindex\"); Pkg.build(\"LASindex\")" + - echo "%JL_BUILD_SCRIPT%" + - C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%" test_script: - - C:\projects\julia\bin\julia -e "Pkg.test(\"LASindex\")" + - echo "%JL_TEST_SCRIPT%" + - C:\julia\bin\julia -e "%JL_TEST_SCRIPT%" + +# # Uncomment to support code coverage upload. Should only be enabled for packages +# # which would have coverage gaps without running on Windows +# on_success: +# - echo "%JL_CODECOV_SCRIPT%" +# - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%" diff --git a/src/LASindex.jl b/src/LASindex.jl index 6347c19..35c0904 100644 --- a/src/LASindex.jl +++ b/src/LASindex.jl @@ -1,10 +1,8 @@ -__precompile__() - module LASindex using FileIO using RegionTrees - using StaticArrays + using StaticArrays export quadtree diff --git a/src/fileio.jl b/src/fileio.jl index b4007a5..27c3a8e 100644 --- a/src/fileio.jl +++ b/src/fileio.jl @@ -1,6 +1,6 @@ using FileIO -type LaxHeader +struct LaxHeader version::UInt32 end @@ -10,7 +10,7 @@ function Base.read(io::IO, ::Type{LaxHeader}) ) end -type LaxQuadtreeHeader +struct LaxQuadtreeHeader ssignature::UInt32 # LASS stype::UInt32 qsignature::UInt32 # LASQ @@ -41,7 +41,7 @@ function Base.read(io::IO, ::Type{LaxQuadtreeHeader}) ) end -type LaxIntervalHeader +struct LaxIntervalHeader signature::UInt32 version::UInt32 number_cells::UInt32 @@ -55,7 +55,7 @@ function Base.read(io::IO, ::Type{LaxIntervalHeader}) ) end -type LaxIntervalCell +struct LaxIntervalCell cell_index::Int32 number_intervals::UInt32 number_points::UInt32 @@ -69,7 +69,7 @@ function Base.read(io::IO, ::Type{LaxIntervalCell}) ) end -type LaxIntervalCellInterval +struct LaxIntervalCellInterval _start::UInt32 _end::UInt32 end @@ -112,7 +112,7 @@ function load(s::Stream{format"LAX"}) # Read cell and its intervals qcell = read(s, LaxIntervalCell) total_points += qcell.number_points - intervals = Vector{UnitRange{Integer}}(qcell.number_intervals) + intervals = Vector{UnitRange{Integer}}(undef, qcell.number_intervals) for j = 1:qcell.number_intervals intervals[j] = read(s, UnitRange{Integer}) @@ -126,7 +126,7 @@ function load(s::Stream{format"LAX"}) # assert we are at end of file @assert eof(s) - info("Processed $(get(s.filename, ".lax")) with $(total_points) points.") + @info("Processed $(s.filename) with $(total_points) points.") return qt end diff --git a/src/quadtree.jl b/src/quadtree.jl index 93261af..213e774 100644 --- a/src/quadtree.jl +++ b/src/quadtree.jl @@ -13,7 +13,7 @@ end """Split a quadtree until the requested index is reached.""" function quadtree!(root::RegionTrees.Cell, index::Integer) places = zlevels(index) - places = flipdim(places, 1) # bottom up + places = reverse(places, dims=1) # bottom up for place in places (place != 0) && (isleaf(root)) && (split!(root)) diff --git a/src/util.jl b/src/util.jl index efee036..07cbaee 100644 --- a/src/util.jl +++ b/src/util.jl @@ -1,5 +1,8 @@ """Merge vector of UnitRanges into Vector of UnitRanges that do not overlap.""" function merge(ranges::Vector{UnitRange{Integer}}) + # prevent unwanted mutation + ranges = copy(ranges) + # Skip if there's nothing to merge length(ranges) <= 1 && (return ranges) diff --git a/test/runtests.jl b/test/runtests.jl index 53ddcd1..5ed7b1f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,7 +2,7 @@ using LASindex using FileIO using RegionTrees using StaticArrays -using Base.Test +using Test workdir = dirname(@__FILE__) @@ -54,6 +54,8 @@ LASindex.quadtree!(root, 1, [2:5]) # Merge UnitRanges that do have overlap r = Vector{UnitRange{Integer}}([1:5, 2:4, 12:13, 14:16]) @test LASindex.merge(r) == Vector{UnitRange{Integer}}([1:5, 12:16]) +# and again to make sure it's not mutating +@test LASindex.merge(r) == Vector{UnitRange{Integer}}([1:5, 12:16]) r = Vector{UnitRange{Integer}}([1:5, 2:6, 12:13, 14:16, -1:2]) @test LASindex.merge(r) == Vector{UnitRange{Integer}}([-1:6, 12:16]) r = Vector{UnitRange{Integer}}()