Skip to content

Commit

Permalink
Merge pull request #27 from nicoleepp/ne/fix-1.0
Browse files Browse the repository at this point in the history
Fix tests on julia 1.0
  • Loading branch information
omus authored Sep 20, 2018
2 parents 253e075 + 396db15 commit 8bf579f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ os:
- osx
julia:
- 0.6
- 0.7
- 1.0
- nightly
notifications:
email: false
Expand Down
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
julia 0.6
Compat 0.64.0
Compat 1.1.0
30 changes: 18 additions & 12 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
environment:
matrix:
- julia_version: 0.6
- julia_version: 0.7
- julia_version: latest
- julia_version: 1
- julia_version: nightly

platform:
- x86
- x64
- 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: latest
# # 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:
Expand All @@ -26,12 +26,18 @@ notifications:
on_build_status_changed: false

install:
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/master/bin/install.ps1'))
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))

build_script:
- echo "%JL_BUILD_SCRIPT%"
- julia -e "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"

test_script:
- echo "%JL_TEST_SCRIPT%"
- julia -e "%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%"
8 changes: 5 additions & 3 deletions src/FixedPointDecimals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ export FixedDecimal, RoundThrows

using Compat: lastindex, something

import Compat: floatmin, floatmax

import Base: reinterpret, zero, one, abs, sign, ==, <, <=, +, -, /, *, div, rem, divrem,
fld, mod, fldmod, fld1, mod1, fldmod1, isinteger, typemin, typemax,
realmin, realmax, print, show, string, convert, parse, promote_rule, min, max,
print, show, string, convert, parse, promote_rule, min, max,
trunc, round, floor, ceil, eps, float, widemul, decompose

const BitInteger = Union{Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64,
Expand Down Expand Up @@ -339,8 +341,8 @@ typemin(::Type{FD{T, f}}) where {T, f} = reinterpret(FD{T, f}, typemin(T))
typemax(::Type{FD{T, f}}) where {T, f}= reinterpret(FD{T, f}, typemax(T))
eps(::Type{T}) where {T <: FD} = reinterpret(T, 1)
eps(x::FD) = eps(typeof(x))
realmin(::Type{T}) where {T <: FD} = eps(T)
realmax(::Type{T}) where {T <: FD} = typemax(T)
floatmin(::Type{T}) where {T <: FD} = eps(T)
floatmax(::Type{T}) where {T <: FD} = typemax(T)

# printing
function print(io::IO, x::FD{T, 0}) where T
Expand Down
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ end
@test FD2(42.42) * FD2(1) == FD2(42.42)
end

@testset "eps, realmin, realmax" begin
@test realmin(FD2) == eps(FD2) == FD2(0.01)
@testset "eps, floatmin, floatmax" begin
@test floatmin(FD2) == eps(FD2) == FD2(0.01)
@test eps(FD2(1.11)) == FD2(0.01)
for x in keyvalues[FD2]
if x typemax(FD2)
Expand All @@ -298,7 +298,7 @@ end
if x typemin(FD2)
@test x - eps(x) < x
if x 0
@test realmin(FD2) abs(x) realmax(FD2)
@test floatmin(FD2) abs(x) floatmax(FD2)
end
end
end
Expand Down

0 comments on commit 8bf579f

Please sign in to comment.