From c7a230af3d8331065b7baa92e1d322d15d5b0428 Mon Sep 17 00:00:00 2001 From: "David P. Sanders" Date: Mon, 6 Mar 2017 18:00:13 -0600 Subject: [PATCH] Remove support for Julia v0.4 (#244) * Change REQUIRE to Julia 0.5 * Update test files to remove Julia 0.4 references * Remove @compat * Update .travis.yml * Allow failure on 0.6 until all pieces are in place for tests to pass --- .travis.yml | 3 ++- REQUIRE | 2 +- src/ValidatedNumerics.jl | 8 +------- src/display.jl | 2 -- src/intervals/intervals.jl | 4 ++-- src/intervals/rounding_macros.jl | 8 ++++---- test/decoration_tests/decoration_tests.jl | 7 +------ test/display_tests/display.jl | 7 +------ test/interval_tests/complex.jl | 7 +------ test/interval_tests/consistency.jl | 8 ++------ test/interval_tests/construction.jl | 8 ++------ test/interval_tests/hyperbolic.jl | 8 ++------ test/interval_tests/linear_algebra.jl | 8 ++------ test/interval_tests/loops.jl | 8 +------- test/interval_tests/non_BigFloat.jl | 7 +------ test/interval_tests/numeric.jl | 7 +------ test/interval_tests/parsing.jl | 1 + test/interval_tests/rounding_macros.jl | 2 +- test/interval_tests/set_operations.jl | 7 +------ test/interval_tests/trig.jl | 7 +------ test/multidim_tests/multidim.jl | 8 ++------ test/root_finding_tests/bisect.jl | 8 ++------ test/root_finding_tests/dual_promotion.jl | 8 ++------ test/root_finding_tests/findroots.jl | 9 ++------- test/runtests.jl | 9 ++------- 25 files changed, 38 insertions(+), 123 deletions(-) diff --git a/.travis.yml b/.travis.yml index c02abbb..713fd07 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,12 +9,13 @@ os: - linux julia: - - 0.4 - 0.5 + - 0.6 - nightly matrix: allow_failures: + - julia: 0.6 - julia: nightly notifications: diff --git a/REQUIRE b/REQUIRE index 0f60460..29b24df 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,4 +1,4 @@ -julia 0.4 +julia 0.5 CRlibm 0.5 Compat 0.7.11 FixedSizeArrays 0.1.2 diff --git a/src/ValidatedNumerics.jl b/src/ValidatedNumerics.jl index df7fedf..3c21a0a 100644 --- a/src/ValidatedNumerics.jl +++ b/src/ValidatedNumerics.jl @@ -54,14 +54,8 @@ export export RootFinding -if VERSION >= v"0.5.0-dev+1182" - import Base: rounding, setrounding, setprecision -else - import Compat: - rounding, setrounding, setprecision +import Base: rounding, setrounding, setprecision - export rounding, setrounding, setprecision # reexport -end ## Multidimensional diff --git a/src/display.jl b/src/display.jl index 5a4b85e..d302087 100644 --- a/src/display.jl +++ b/src/display.jl @@ -57,8 +57,6 @@ end function round_string(x::BigFloat, digits::Int, r::RoundingMode) lng = digits + Int32(8) - # buf = Array(UInt8, lng + 1) - # @compat buf = Base.StringVector(lng + 1) buf = Array{UInt8}(lng + 1) lng = ccall((:mpfr_snprintf,:libmpfr), Int32, diff --git a/src/intervals/intervals.jl b/src/intervals/intervals.jl index 741810c..071316b 100644 --- a/src/intervals/intervals.jl +++ b/src/intervals/intervals.jl @@ -47,9 +47,9 @@ eltype{T<:Real}(x::Interval{T}) = T Interval(x::Interval) = x Interval(x::Complex) = Interval(real(x)) + im*Interval(imag(x)) -@compat (::Type{Interval{T}}){T}(x) = Interval(convert(T, x)) +(::Type{Interval{T}}){T}(x) = Interval(convert(T, x)) -@compat (::Type{Interval{T}}){T}(x::Interval) = convert(Interval{T}, x) +(::Type{Interval{T}}){T}(x::Interval) = convert(Interval{T}, x) ## Include files include("special.jl") diff --git a/src/intervals/rounding_macros.jl b/src/intervals/rounding_macros.jl index 485fa92..b66efd3 100644 --- a/src/intervals/rounding_macros.jl +++ b/src/intervals/rounding_macros.jl @@ -13,7 +13,7 @@ function round_expr(ex::Expr, rounding_mode::RoundingMode) op = ex.args[1] if op ∈ (:min, :max) - @compat mapped_args = round_expr.(ex.args[2:end], [rounding_mode]) # only in 0.5 and 0.6; in 0.6, can remove [...] around rounding_mode + mapped_args = round_expr.(ex.args[2:end], [rounding_mode]) # only in 0.5 and 0.6; in 0.6, can remove [...] around rounding_mode return :($op($(mapped_args...))) end @@ -46,14 +46,14 @@ The macro uses the internal `round_expr` function to transform e.g. The user-facing equivalent is `@interval`, which can handle much more general cases. """ -@compat macro round(ex1, ex2) +macro round(ex1, ex2) :(Interval($(round_expr(ex1, RoundDown)), $(round_expr(ex2, RoundUp)))) end -@compat macro round_down(ex1) +macro round_down(ex1) round_expr(ex1, RoundDown) end -@compat macro round_up(ex1) +macro round_up(ex1) round_expr(ex1, RoundUp) end diff --git a/test/decoration_tests/decoration_tests.jl b/test/decoration_tests/decoration_tests.jl index ebfeee3..3ec7244 100644 --- a/test/decoration_tests/decoration_tests.jl +++ b/test/decoration_tests/decoration_tests.jl @@ -1,10 +1,5 @@ -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end using ValidatedNumerics +using Base.Test @testset "DecoratedInterval tests" begin a = DecoratedInterval(@interval(1, 2), com) diff --git a/test/display_tests/display.jl b/test/display_tests/display.jl index 8bcfb5a..2ec2c11 100644 --- a/test/display_tests/display.jl +++ b/test/display_tests/display.jl @@ -1,10 +1,5 @@ -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end using ValidatedNumerics +using Base.Test setprecision(Interval, Float64) diff --git a/test/interval_tests/complex.jl b/test/interval_tests/complex.jl index 1f67638..9e20a1d 100644 --- a/test/interval_tests/complex.jl +++ b/test/interval_tests/complex.jl @@ -1,10 +1,5 @@ -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end using ValidatedNumerics +using Base.Test @testset "Complex interval operations" begin a = @interval 1im diff --git a/test/interval_tests/consistency.jl b/test/interval_tests/consistency.jl index 3d8c7e0..c2e5b2c 100644 --- a/test/interval_tests/consistency.jl +++ b/test/interval_tests/consistency.jl @@ -1,12 +1,8 @@ # This file is part of the ValidatedNumerics.jl package; MIT licensed -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end using ValidatedNumerics +using Base.Test + setprecision(Interval, Float64) diff --git a/test/interval_tests/construction.jl b/test/interval_tests/construction.jl index 353a540..7755c4e 100644 --- a/test/interval_tests/construction.jl +++ b/test/interval_tests/construction.jl @@ -1,12 +1,8 @@ # This file is part of the ValidatedNumerics.jl package; MIT licensed -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end using ValidatedNumerics +using Base.Test + @testset "Constructing intervals" begin setprecision(Interval, 53) diff --git a/test/interval_tests/hyperbolic.jl b/test/interval_tests/hyperbolic.jl index 5bc77d0..0089edb 100644 --- a/test/interval_tests/hyperbolic.jl +++ b/test/interval_tests/hyperbolic.jl @@ -1,12 +1,8 @@ # This file is part of the ValidatedNumerics.jl package; MIT licensed -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end using ValidatedNumerics +using Base.Test + setprecision(Interval, 128) setprecision(Interval, Float64) diff --git a/test/interval_tests/linear_algebra.jl b/test/interval_tests/linear_algebra.jl index e00f408..3511f58 100644 --- a/test/interval_tests/linear_algebra.jl +++ b/test/interval_tests/linear_algebra.jl @@ -1,10 +1,6 @@ -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end using ValidatedNumerics +using Base.Test + A = diff --git a/test/interval_tests/loops.jl b/test/interval_tests/loops.jl index 666db2f..e85846e 100644 --- a/test/interval_tests/loops.jl +++ b/test/interval_tests/loops.jl @@ -1,11 +1,5 @@ -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end using ValidatedNumerics - +using Base.Test @testset "Interval loop tests" begin diff --git a/test/interval_tests/non_BigFloat.jl b/test/interval_tests/non_BigFloat.jl index e384d57..d1be353 100644 --- a/test/interval_tests/non_BigFloat.jl +++ b/test/interval_tests/non_BigFloat.jl @@ -1,10 +1,5 @@ -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end using ValidatedNumerics +using Base.Test @testset "Tests with rational intervals" begin diff --git a/test/interval_tests/numeric.jl b/test/interval_tests/numeric.jl index 97a5320..99b5abd 100644 --- a/test/interval_tests/numeric.jl +++ b/test/interval_tests/numeric.jl @@ -1,12 +1,7 @@ # This file is part of the ValidatedNumerics.jl package; MIT licensed -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end using ValidatedNumerics +using Base.Test setprecision(Interval, Float64) setrounding(Interval, :narrow) diff --git a/test/interval_tests/parsing.jl b/test/interval_tests/parsing.jl index 4900e57..417a5e5 100644 --- a/test/interval_tests/parsing.jl +++ b/test/interval_tests/parsing.jl @@ -1,4 +1,5 @@ using ValidatedNumerics +using Base.Test setdisplay(:standard, decorations=true, sigfigs=6) diff --git a/test/interval_tests/rounding_macros.jl b/test/interval_tests/rounding_macros.jl index 3312f74..932d8a1 100644 --- a/test/interval_tests/rounding_macros.jl +++ b/test/interval_tests/rounding_macros.jl @@ -1,5 +1,5 @@ using ValidatedNumerics - +using Base.Test @test ValidatedNumerics.round_expr(:(a + b), RoundDown) == :($(Expr(:escape, :a)) + $(Expr(:escape, :b)) + $(RoundDown)) diff --git a/test/interval_tests/set_operations.jl b/test/interval_tests/set_operations.jl index 30e84bb..732ef28 100644 --- a/test/interval_tests/set_operations.jl +++ b/test/interval_tests/set_operations.jl @@ -1,12 +1,7 @@ # This file is part of the ValidatedNumerics.jl package; MIT licensed -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end using ValidatedNumerics +using Base.Test setprecision(Interval, Float64) diff --git a/test/interval_tests/trig.jl b/test/interval_tests/trig.jl index ed3ee16..61b088a 100644 --- a/test/interval_tests/trig.jl +++ b/test/interval_tests/trig.jl @@ -1,12 +1,7 @@ # This file is part of the ValidatedNumerics.jl package; MIT licensed -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end using ValidatedNumerics +using Base.Test setprecision(Interval, 128) setprecision(Interval, Float64) diff --git a/test/multidim_tests/multidim.jl b/test/multidim_tests/multidim.jl index f273c6a..52e9715 100644 --- a/test/multidim_tests/multidim.jl +++ b/test/multidim_tests/multidim.jl @@ -1,10 +1,6 @@ -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end using ValidatedNumerics +using Base.Test + @testset "Operations on boxes" begin A = IntervalBox(1..2, 3..4) diff --git a/test/root_finding_tests/bisect.jl b/test/root_finding_tests/bisect.jl index fa9d60c..1f1159e 100644 --- a/test/root_finding_tests/bisect.jl +++ b/test/root_finding_tests/bisect.jl @@ -1,10 +1,6 @@ -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end using ValidatedNumerics, ValidatedNumerics.RootFinding +using Base.Test + @testset "Bisection tests" begin x = Interval(0, 1) diff --git a/test/root_finding_tests/dual_promotion.jl b/test/root_finding_tests/dual_promotion.jl index 6bbd900..b953da4 100644 --- a/test/root_finding_tests/dual_promotion.jl +++ b/test/root_finding_tests/dual_promotion.jl @@ -1,11 +1,7 @@ -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end using ValidatedNumerics, ValidatedNumerics.RootFinding using ForwardDiff +using Base.Test + const Dual = ForwardDiff.Dual diff --git a/test/root_finding_tests/findroots.jl b/test/root_finding_tests/findroots.jl index 2d22209..2df9714 100644 --- a/test/root_finding_tests/findroots.jl +++ b/test/root_finding_tests/findroots.jl @@ -1,12 +1,7 @@ -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end + using ValidatedNumerics, ValidatedNumerics.RootFinding using ForwardDiff - +using Base.Test const D = RootFinding.derivative diff --git a/test/runtests.jl b/test/runtests.jl index b965663..e863665 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,11 +1,6 @@ -if VERSION >= v"0.5.0-dev+7720" - using Base.Test -else - using BaseTestNext - const Test = BaseTestNext -end -using ValidatedNumerics +using ValidatedNumerics +using Base.Test # Interval tests: