|
3 | 3 | // RUN: %S/../../utils/line-directive %t/FloatingPoint.swift -- %target-run %t/a.out
|
4 | 4 | // REQUIRES: executable_test
|
5 | 5 |
|
| 6 | +%{ |
| 7 | +from gyb_stdlib_unittest_support import TRACE, stackTrace, trace |
| 8 | +}% |
| 9 | + |
6 | 10 | import Swift
|
7 | 11 | import StdlibUnittest
|
8 | 12 |
|
9 |
| - |
10 | 13 | #if arch(i386) || arch(x86_64)
|
11 | 14 |
|
12 | 15 | struct Float80Bits : Equatable, CustomStringConvertible {
|
@@ -51,6 +54,29 @@ extension Float80 {
|
51 | 54 |
|
52 | 55 | #endif
|
53 | 56 |
|
| 57 | +% for (FloatTy, BitPatternTy) in [ |
| 58 | +% ('Float', 'UInt32'), |
| 59 | +% ('Double', 'UInt64'), |
| 60 | +% ('Float80', 'Float80Bits') |
| 61 | +% ]: |
| 62 | +% if FloatTy == 'Float80': |
| 63 | +#if arch(i386) || arch(x86_64) |
| 64 | +% end |
| 65 | +func expectBitwiseEqual( |
| 66 | + _ expected: ${FloatTy}, _ actual: ${FloatTy}, ${TRACE} |
| 67 | +) { |
| 68 | + expectEqual(expected.bitPattern, actual.bitPattern, ${trace}) |
| 69 | +} |
| 70 | +func expectBitwiseEqual( |
| 71 | + bitPattern expected: ${BitPatternTy}, _ actual: ${FloatTy}, ${TRACE} |
| 72 | +) { |
| 73 | + expectBitwiseEqual(${FloatTy}(bitPattern: expected), actual, ${trace}) |
| 74 | +} |
| 75 | +% if FloatTy == 'Float80': |
| 76 | +#endif |
| 77 | +% end |
| 78 | +% end |
| 79 | + |
54 | 80 | var FloatingPoint = TestSuite("FloatingPoint")
|
55 | 81 |
|
56 | 82 | func positiveOne<T: IntegerLiteralConvertible>() -> T {
|
|
0 commit comments