|
10 | 10 |
|
11 | 11 | import StdlibUnittest
|
12 | 12 |
|
13 |
| - |
14 | 13 | %{
|
15 | 14 |
|
16 | 15 | floatNameToSignificandBits = { 'Float32':24, 'Float64':53, 'Float80':64 }
|
@@ -110,44 +109,16 @@ FloatingPointConversionFailures.test("${OtherFloat}To${Self}FailableConversion/d
|
110 | 109 |
|
111 | 110 | % end
|
112 | 111 |
|
113 |
| -FloatingPointConversionTruncations.test("${OtherFloat}To${Self}Conversion/dest=NaN") { |
114 |
| - let input = ${OtherFloat}.nan |
115 |
| - var result = ${Self}(input) |
116 |
| - var resultConvertedBack = ${OtherFloat}(result) |
117 |
| - expectTrue(input.isNaN) |
118 |
| - expectTrue(resultConvertedBack.isNaN) |
| 112 | +FloatingPointConversionTruncations.test("${OtherFloat}To${Self}Conversion/special") { |
| 113 | + expectEqual( ${Self}.infinity, ${Self}( ${OtherFloat}.infinity)) |
| 114 | + expectEqual(-${Self}.infinity, ${Self}(-${OtherFloat}.infinity)) |
| 115 | + expectTrue(${Self}(${OtherFloat}.nan).isNaN) |
119 | 116 | }
|
120 | 117 |
|
121 |
| -FloatingPointConversionFailures.test("${OtherFloat}To${Self}Conversion/dest=NaN") { |
122 |
| - let input = ${OtherFloat}.nan |
123 |
| - var result = ${Self}(exactly: input) |
124 |
| - expectEmpty(result) |
125 |
| -} |
126 |
| - |
127 |
| -FloatingPointConversionTruncations.test("${OtherFloat}To${Self}Conversion/dest=inf") { |
128 |
| - let input = ${OtherFloat}.infinity |
129 |
| - var result = ${Self}(input) |
130 |
| - var resultConvertedBack = ${OtherFloat}(result) |
131 |
| - expectEqual(input, resultConvertedBack) |
132 |
| -} |
133 |
| - |
134 |
| -FloatingPointConversionFailures.test("${OtherFloat}To${Self}Conversion/dest=inf") { |
135 |
| - let input = ${OtherFloat}.infinity |
136 |
| - var result = ${Self}(exactly: input) |
137 |
| - expectEqual(${Self}.infinity, result) |
138 |
| -} |
139 |
| - |
140 |
| -FloatingPointConversionTruncations.test("${OtherFloat}To${Self}Conversion/dest=-inf") { |
141 |
| - let input = -${OtherFloat}.infinity |
142 |
| - var result = ${Self}(input) |
143 |
| - var resultConvertedBack = ${OtherFloat}(result) |
144 |
| - expectEqual(input, resultConvertedBack) |
145 |
| -} |
146 |
| - |
147 |
| -FloatingPointConversionFailures.test("${OtherFloat}To${Self}Conversion/dest=-inf") { |
148 |
| - let input = -${OtherFloat}.infinity |
149 |
| - var result = ${Self}(exactly: input) |
150 |
| - expectEqual(-${Self}.infinity, result) |
| 118 | +FloatingPointConversionFailures.test("${OtherFloat}To${Self}Conversion/special") { |
| 119 | + expectEqual( ${Self}.infinity, ${Self}(exactly: ${OtherFloat}.infinity)) |
| 120 | + expectEqual(-${Self}.infinity, ${Self}(exactly: -${OtherFloat}.infinity)) |
| 121 | + expectEmpty(${Self}(exactly: ${OtherFloat}.nan)) |
151 | 122 | }
|
152 | 123 |
|
153 | 124 | % if OtherFloat == 'Float80':
|
|
0 commit comments