@@ -28,7 +28,7 @@ func expectOverflow<T>(
28
28
@autoclosure _ message: () -> String = "",
29
29
showFrame: Bool = true,
30
30
stackTrace: SourceLocStack = SourceLocStack(),
31
- file: String = __FILE__ , line: UInt = __LINE__
31
+ file: String = #file , line: UInt = #line
32
32
) {
33
33
expectTrue(
34
34
res.overflow, "expected overflow",
@@ -41,7 +41,7 @@ func expectNoOverflow<T>(
41
41
@autoclosure _ message: () -> String = "",
42
42
showFrame: Bool = true,
43
43
stackTrace: SourceLocStack = SourceLocStack(),
44
- file: String = __FILE__ , line: UInt = __LINE__
44
+ file: String = #file , line: UInt = #line
45
45
) {
46
46
expectFalse(
47
47
res.overflow, "expected no overflow",
@@ -68,45 +68,45 @@ var FixedPointArithmeticTraps = TestSuite("FixedPointArithmeticTraps")
68
68
69
69
FixedPointArithmeticTraps.test("PreDecrement/${IntTy}") {
70
70
var x = get${IntTy}(${IntTy}.min)
71
- ++x
71
+ x += 1
72
72
73
73
x = get${IntTy}(${IntTy}.min)
74
74
expectCrashLater()
75
75
// --IntTy.min
76
- --x
76
+ x -= 1
77
77
_blackHole(x)
78
78
}
79
79
80
80
FixedPointArithmeticTraps.test("PreIncrement/${IntTy}") {
81
81
var x = get${IntTy}(${IntTy}.max)
82
- --x
82
+ x -= 1
83
83
84
84
x = get${IntTy}(${IntTy}.max)
85
85
expectCrashLater()
86
86
// ++IntTy.max
87
- ++x
87
+ x += 1
88
88
_blackHole(x)
89
89
}
90
90
91
91
FixedPointArithmeticTraps.test("PostDecrement/${IntTy}") {
92
92
var x = get${IntTy}(${IntTy}.min)
93
- x++
93
+ x += 1
94
94
95
95
x = get${IntTy}(${IntTy}.min)
96
96
expectCrashLater()
97
97
// IntTy.min--
98
- x--
98
+ x -= 1
99
99
_blackHole(x)
100
100
}
101
101
102
102
FixedPointArithmeticTraps.test("PostIncrement/${IntTy}") {
103
103
var x = get${IntTy}(${IntTy}.max)
104
- x--
104
+ x -= 1
105
105
106
106
x = get${IntTy}(${IntTy}.max)
107
107
expectCrashLater()
108
108
// IntTy.max++
109
- x++
109
+ x += 1
110
110
_blackHole(x)
111
111
}
112
112
0 commit comments