Skip to content

Commit 8d17739

Browse files
kimikagetimholy
authored andcommitted
Remove testapprox dependency and Reduce the number of test cases for display (#135)
1 parent ee5bd54 commit 8d17739

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
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: 5 additions & 11 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

0 commit comments

Comments
 (0)