@@ -37,7 +37,7 @@ final class IntegerUtilitiesShiftTests: XCTestCase {
3737 case . toNearestOrAwayFromZero:
3838 if exact { expected = floor }
3939 else {
40- let step = value. shifted ( right : count - 2 , rounding: . toOdd)
40+ let step = value. shifted ( rightBy : count - 2 , rounding: . toOdd)
4141 switch step & 0b11 {
4242 case 0b01 : expected = floor
4343 case 0b10 : expected = value > 0 ? ceiling : floor
@@ -48,7 +48,7 @@ final class IntegerUtilitiesShiftTests: XCTestCase {
4848 case . toNearestOrEven:
4949 if exact { expected = floor }
5050 else {
51- let step = value. shifted ( right : count - 2 , rounding: . toOdd)
51+ let step = value. shifted ( rightBy : count - 2 , rounding: . toOdd)
5252 switch step & 0b11 {
5353 case 0b01 : expected = floor
5454 case 0b10 : expected = floor & 1 == 0 ? floor : ceiling
@@ -61,9 +61,9 @@ final class IntegerUtilitiesShiftTests: XCTestCase {
6161 // or ceiling.
6262 if exact { expected = floor }
6363 else {
64- let observed = value. shifted ( right : count, rounding: rule)
64+ let observed = value. shifted ( rightBy : count, rounding: rule)
6565 if observed != floor && observed != ceiling {
66- print ( " Error found in \( T . self) .shifted(right : \( count) , rounding: \( rule) ). " )
66+ print ( " Error found in \( T . self) .shifted(rightBy : \( count) , rounding: \( rule) ). " )
6767 print ( " Value: \( String ( value, radix: 16 ) ) " )
6868 print ( " Expected: \( String ( floor, radix: 16 ) ) or \( String ( ceiling, radix: 16 ) ) " )
6969 print ( " Observed: \( String ( observed, radix: 16 ) ) " )
@@ -74,9 +74,9 @@ final class IntegerUtilitiesShiftTests: XCTestCase {
7474 case . requireExact:
7575 preconditionFailure ( )
7676 }
77- let observed = value. shifted ( right : count, rounding: rule)
77+ let observed = value. shifted ( rightBy : count, rounding: rule)
7878 if observed != expected {
79- print ( " Error found in \( T . self) .shifted(right : \( count) , rounding: \( rule) ). " )
79+ print ( " Error found in \( T . self) .shifted(rightBy : \( count) , rounding: \( rule) ). " )
8080 print ( " Value: \( String ( value, radix: 16 ) ) " )
8181 print ( " Expected: \( String ( expected, radix: 16 ) ) " )
8282 print ( " Observed: \( String ( observed, radix: 16 ) ) " )
@@ -89,7 +89,7 @@ final class IntegerUtilitiesShiftTests: XCTestCase {
8989 ) {
9090 for count in - 2 * T. bitWidth ... 2 * T. bitWidth {
9191 // zero shifted by anything is always zero
92- XCTAssertEqual ( 0 , ( 0 as T ) . shifted ( right : count, rounding: rule) )
92+ XCTAssertEqual ( 0 , ( 0 as T ) . shifted ( rightBy : count, rounding: rule) )
9393 for _ in 0 ..< 100 {
9494 testRoundingShift ( T . random ( in: . min ... . max) , count, rounding: rule)
9595 }
@@ -147,7 +147,7 @@ final class IntegerUtilitiesShiftTests: XCTestCase {
147147 var fails = 0
148148 for count in 0 ... 64 {
149149 let sum = ( 0 ..< 1024 ) . reduce ( into: 0.0 ) { sum, _ in
150- let rounded = value. shifted ( right : count, rounding: . stochastically)
150+ let rounded = value. shifted ( rightBy : count, rounding: . stochastically)
151151 sum += Double ( rounded)
152152 }
153153 let expected = Double ( sign: . plus, exponent: - count, significand: 1024 * Double( value) )
@@ -164,15 +164,15 @@ final class IntegerUtilitiesShiftTests: XCTestCase {
164164 // but if you see a repeated failure for a given shift count, that's
165165 // almost surely a real bug.
166166 XCTAssertLessThanOrEqual ( difference, 64 ,
167- " Accumulated error ( \( difference) ) was unexpectedly large in \( value) .shifted(right : \( count) ) "
167+ " Accumulated error ( \( difference) ) was unexpectedly large in \( value) .shifted(rightBy : \( count) ) "
168168 )
169169 }
170170 // Threshold chosen so that this is expected to _almost always_ pass, but
171171 // it may fail sporadically. This is not a great fit for CI workflows,
172172 // sorry. Basically ignore one-off failures, but a repeated failure here
173173 // is an indication that a bug exists.
174174 XCTAssertLessThanOrEqual ( fails, 16 ,
175- " Accumulated error was large more often than expected for \( value) .shifted(right :) "
175+ " Accumulated error was large more often than expected for \( value) .shifted(rightBy :) "
176176 )
177177 }
178178
0 commit comments