Skip to content

Commit 22b8e46

Browse files
authored
Adding some more tests for [U]Int128 in BinaryInteger+FormatStyleTests.swift and JSONEncoderTests.swift (#806)
* Update JSONEncoderTests.swift Update minimum OS version for Int128 in testTypeCoercion() * Update JSONEncoderTests.swift Add more Int128 test for testTypeCoercion() * Update JSONEncoderTests.swift Add more test case Int128 for for testTypeCoercion() * Update JSONEncoderTests.swift Add more test case UInt128 for for testTypeCoercion() * Update URL.swift Correct typo comment from "resovled" to "resolved" at URL.swift * Update BinaryInteger+FormatStyleTests.swift Adding more case to testing [U]Int128 * Update BinaryInteger+FormatStyleTests.swift Adding more case to testing [U]Int128 * Update JSONEncoderTests.swift Replace "@available" with "#available". * Update BinaryInteger+FormatStyleTests.swift Replace "@available" with "#available".
1 parent 628fe67 commit 22b8e46

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

Sources/FoundationEssentials/URL/URL.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ public struct URL: Equatable, Sendable, Hashable {
10401040
return basePath.merging(relativePath: relativePath)
10411041
}
10421042

1043-
/// Calculate the "merged" path that is resovled against the base URL
1043+
/// Calculate the "merged" path that is resolved against the base URL
10441044
private var mergedPath: String {
10451045
return mergedPath(for: relativePath())
10461046
}

Tests/FoundationEssentialsTests/Formatting/BinaryInteger+FormatStyleTests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,17 @@ final class BinaryIntegerFormatStyleTests: XCTestCase {
4343
check(type: Int16.self, min: "-32768", max: "32767")
4444
check(type: Int32.self, min: "-2147483648", max: "2147483647")
4545
check(type: Int64.self, min: "-9223372036854775808", max: "9223372036854775807")
46+
if #available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) {
47+
check(type: Int128.self, min: "-170141183460469231731687303715884105728", max: "170141183460469231731687303715884105727")
48+
}
4649

4750
check(type: UInt8.self, min: "0", max: "255")
4851
check(type: UInt16.self, min: "0", max: "65535")
4952
check(type: UInt32.self, min: "0", max: "4294967295")
5053
check(type: UInt64.self, min: "0", max: "18446744073709551615")
54+
if #available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) {
55+
check(type: UInt128.self, min: "0", max: "340282366920938463463374607431768211455")
56+
}
5157
}
5258

5359
func testNumericStringRepresentation_builtinIntegersAroundDecimalMagnitude() throws {

Tests/FoundationEssentialsTests/JSONEncoderTests.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,24 +595,33 @@ final class JSONEncoderTests : XCTestCase {
595595
_testRoundTripTypeCoercionFailure(of: [false, true], as: [Int16].self)
596596
_testRoundTripTypeCoercionFailure(of: [false, true], as: [Int32].self)
597597
_testRoundTripTypeCoercionFailure(of: [false, true], as: [Int64].self)
598+
if #available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) {
599+
_testRoundTripTypeCoercionFailure(of: [false, true], as: [Int128].self)
600+
}
598601
_testRoundTripTypeCoercionFailure(of: [false, true], as: [UInt].self)
599602
_testRoundTripTypeCoercionFailure(of: [false, true], as: [UInt8].self)
600603
_testRoundTripTypeCoercionFailure(of: [false, true], as: [UInt16].self)
601604
_testRoundTripTypeCoercionFailure(of: [false, true], as: [UInt32].self)
602605
_testRoundTripTypeCoercionFailure(of: [false, true], as: [UInt64].self)
606+
if #available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) {
607+
_testRoundTripTypeCoercionFailure(of: [false, true], as: [UInt128].self)
608+
}
603609
_testRoundTripTypeCoercionFailure(of: [false, true], as: [Float].self)
604610
_testRoundTripTypeCoercionFailure(of: [false, true], as: [Double].self)
605611
_testRoundTripTypeCoercionFailure(of: [0, 1] as [Int], as: [Bool].self)
606612
_testRoundTripTypeCoercionFailure(of: [0, 1] as [Int8], as: [Bool].self)
607613
_testRoundTripTypeCoercionFailure(of: [0, 1] as [Int16], as: [Bool].self)
608614
_testRoundTripTypeCoercionFailure(of: [0, 1] as [Int32], as: [Bool].self)
609615
_testRoundTripTypeCoercionFailure(of: [0, 1] as [Int64], as: [Bool].self)
616+
if #available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) {
617+
_testRoundTripTypeCoercionFailure(of: [0, 1] as [Int128], as: [Bool].self)
618+
}
610619
_testRoundTripTypeCoercionFailure(of: [0, 1] as [UInt], as: [Bool].self)
611620
_testRoundTripTypeCoercionFailure(of: [0, 1] as [UInt8], as: [Bool].self)
612621
_testRoundTripTypeCoercionFailure(of: [0, 1] as [UInt16], as: [Bool].self)
613622
_testRoundTripTypeCoercionFailure(of: [0, 1] as [UInt32], as: [Bool].self)
614623
_testRoundTripTypeCoercionFailure(of: [0, 1] as [UInt64], as: [Bool].self)
615-
if #available(macOS 15.0, *) {
624+
if #available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) {
616625
_testRoundTripTypeCoercionFailure(of: [0, 1] as [UInt128], as: [Bool].self)
617626
}
618627
_testRoundTripTypeCoercionFailure(of: [0.0, 1.0] as [Float], as: [Bool].self)

0 commit comments

Comments
 (0)