@@ -7,6 +7,46 @@ function symbol_to_inttype(::Type{Fixed}, s::Symbol)
77 d[s]
88end
99
10+ # issue #288
11+ # The following needs to be outside of `@testset` to reproduce the issue.
12+ _to_fixed (:: Val , x) = x % Q0f7
13+ _to_fixed (:: Val{:Q0f7} , x) = x % Q0f7
14+ _to_fixed (:: Val{:Q0f15} , x) = x % Q0f15
15+ buf = IOBuffer ()
16+ # in range
17+ for vs in ((:Q0f7 , :Q0f15 ), (:Q0f15 , :Q0f7 ))
18+ for v in vs
19+ show (buf, _to_fixed (Val (v), - 1.0 ))
20+ print (buf, " " )
21+ end
22+ end
23+ issue288_in = String (take! (buf))
24+ # out of range
25+ for vs in ((:Q0f7 , :Q0f15 ), (:Q0f15 , :Q0f7 ))
26+ for v in vs
27+ show (buf, _to_fixed (Val (v), 1.0 ))
28+ print (buf, " " )
29+ end
30+ end
31+ issue288_out = String (take! (buf))
32+
33+ @testset " issue288" begin
34+ expected_issue288 = " -1.0Q0f7 -1.0Q0f15 -1.0Q0f15 -1.0Q0f7 "
35+ if issue288_in == expected_issue288 # just leave it in the report
36+ @test issue288_in == expected_issue288
37+ else
38+ @test_broken issue288_in == expected_issue288
39+ @warn """ broken: "$issue288_in "\n expected: "$expected_issue288 " """
40+ end
41+ expected_issue288 = " -1.0Q0f7 -1.0Q0f15 -1.0Q0f15 -1.0Q0f7 "
42+ if issue288_out == expected_issue288 # just leave it in the report
43+ @test issue288_out == expected_issue288
44+ else
45+ @test_broken issue288_out == expected_issue288
46+ @warn """ broken: "$issue288_out "\n expected: "$expected_issue288 " """
47+ end
48+ end
49+
1050function test_op (fun:: Fun , fx:: F , fy:: F , fxf, fyf, tol) where {Fun, F}
1151 # Make sure that the result is representable
1252 zf = fun (fxf, fyf)
0 commit comments