Skip to content

Remove testapprox dependency and Reduce the number of test cases for display (#133) #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions test/fixed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ end
end

@testset "testapprox" begin
for T in [Fixed{Int8,7}, Fixed{Int16,8}, Fixed{Int16,10}]
testapprox(T) # defined in ufixed.jl
@testset "approx $T" for T in [Fixed{Int8,7}, Fixed{Int16,8}, Fixed{Int16,10}]
xs = typemin(T):eps(T):typemax(T)-eps(T)
@test all(x -> x ≈ x + eps(T), xs)
@test all(x -> x + eps(T) ≈ x, xs)
@test !any(x -> x - eps(T) ≈ x + eps(T), xs)
end
end

Expand Down
16 changes: 5 additions & 11 deletions test/normed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -230,18 +230,12 @@ end
end
end

function testapprox(::Type{T}) where {T}
for x = typemin(T):eps(T):typemax(T)-eps(T)
y = x+eps(T)
@test x ≈ y
@test y ≈ x
@test !(x ≈ y+eps(T))
end
end

@testset "approx" begin
for T in FixedPointNumbers.UF
testapprox(T)
@testset "approx $T" for T in FixedPointNumbers.UF
xs = typemin(T):eps(T):typemax(T)-eps(T)
@test all(x -> x ≈ x + eps(T), xs)
@test all(x -> x + eps(T) ≈ x, xs)
@test !any(x -> x - eps(T) ≈ x + eps(T), xs)
end
end

Expand Down