Skip to content

Commit 9b881cd

Browse files
Gary Liubryanpkc
authored andcommitted
Fix String.init test in FixedPoint.swift.gyb for big-endian systems.
1 parent 71abe8b commit 9b881cd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

validation-test/stdlib/FixedPoint.swift.gyb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,17 @@ FixedPoint.test("OverflowCheck") {
307307

308308
FixedPoint.test("String.init") {
309309
let x: UInt32 = 0xdeadbeef
310+
#if _endian(little)
310311
expectEqual("efbeadde", String(x.bigEndian, radix: 16))
311312

312313
let y = UInt32(bigEndian: 0xdeadbeef)
313314
expectEqual("deadbeef", String(y.bigEndian, radix: 16))
315+
#else
316+
expectEqual("efbeadde", String(x.littleEndian, radix: 16))
317+
318+
let y = UInt32(littleEndian: 0xdeadbeef)
319+
expectEqual("deadbeef", String(y.littleEndian, radix: 16))
320+
#endif
314321
}
315322

316323
FixedPoint.test("byteSwapped") {
@@ -426,5 +433,4 @@ BoolTestSuite.test("||") {
426433
expectFalse(getBool(false) || getBool(false))
427434
}
428435

429-
runAllTests()
430-
436+
runAllTests()

0 commit comments

Comments
 (0)