Skip to content

Commit fc6edec

Browse files
committed
Remove testapprox dependency and Reduce the number of test cases for display
1 parent 70ae1d6 commit fc6edec

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

test/fixed.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,11 @@ end
8484
end
8585

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

test/normed.jl

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -230,18 +230,12 @@ end
230230
end
231231
end
232232

233-
function testapprox(::Type{T}) where {T}
234-
for x = typemin(T):eps(T):typemax(T)-eps(T)
235-
y = x+eps(T)
236-
@test x y
237-
@test y x
238-
@test !(x y+eps(T))
239-
end
240-
end
241-
242233
@testset "approx" begin
243-
for T in FixedPointNumbers.UF
244-
testapprox(T)
234+
@testset "approx $T" for T in FixedPointNumbers.UF
235+
xs = typemin(T):eps(T):typemax(T)-eps(T)
236+
@test all(x -> x x + eps(T), xs)
237+
@test all(x -> x + eps(T) x, xs)
238+
@test !any(x -> x - eps(T) x + eps(T), xs)
245239
end
246240
end
247241

@@ -331,7 +325,7 @@ end
331325
bd, eld = scaledual(Float64, a[1])
332326
@test 1.0*a[1] == bd*eld
333327
bd, ad = scaledual(Float64, a)
334-
@test 1.0*a == bd*ad
328+
@test 1.0*a == bd*ad
335329
end
336330

337331
@testset "reductions" begin

0 commit comments

Comments
 (0)