diff --git a/Tests/EnvironmentDecoderTests/EnvironmentDecoderCustomTypeTests.swift b/Tests/EnvironmentDecoderTests/EnvironmentDecoderCustomTypeTests.swift index 5b57c12..e88247f 100644 --- a/Tests/EnvironmentDecoderTests/EnvironmentDecoderCustomTypeTests.swift +++ b/Tests/EnvironmentDecoderTests/EnvironmentDecoderCustomTypeTests.swift @@ -4,38 +4,40 @@ import Testing struct EnvironmentDecoderCustomTypeTests { @Test func base64DataTest() throws { - #expect(try decode("", as: Data.self) == Data()) - #expect(try decode("AQIDBAUGBwg=", as: Data.self) == Data([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08])) - #expect(try decode("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2ch", as: Data.self) - == Data("The quick brown fox jumped over the lazy dog!".utf8)) - #expect(try decode("VGhl,cXVpY2s=,YnJvd24=,Zm94", as: [Data].self) - == ["The", "quick", "brown", "fox"].map { Data($0.utf8) }) + typealias T = Data + #expect(try decode("", as: T.self) == T()) + #expect(try decode("AQIDBAUGBwg=", as: T.self) == T([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08])) + #expect(try decode("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2ch", as: T.self) + == T("The quick brown fox jumped over the lazy dog!".utf8)) + #expect(try decode("VGhl,cXVpY2s=,YnJvd24=,Zm94", as: [T].self) + == ["The", "quick", "brown", "fox"].map { T($0.utf8) }) #expect(throws: Swift.DecodingError.self) { - try decode(" ", as: Data.self) + try decode(" ", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("invalid-base-64", as: Data.self) + try decode("invalid-base-64", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(nil, as: Data.self) + try decode(nil, as: T.self) } } @Test func delegatedDataTest() throws { + typealias T = Data let decoder = EnvironmentDecoder(dataDecodingStrategy: .deferredToData) - #expect(try decode("", as: Data.self, with: decoder) == Data()) - #expect(try decode("1,2,3,4,5,6,7,8", as: Data.self, with: decoder) == Data([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08])) - #expect(try decode("0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8", as: Data.self, with: decoder) == Data([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08])) - #expect(try decode("0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08", as: Data.self, with: decoder) == Data([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08])) - #expect(try decode("0x54,0x68,0x65,0x20,0x71,0x75,0x69,0x63,0x6b,0x20,0x62,0x72,0x6f,0x77,0x6e,0x20,0x66,0x6f,0x78,0x20,0x6a,0x75,0x6d,0x70,0x65,0x64,0x20,0x6f,0x76,0x65,0x72,0x20,0x74,0x68,0x65,0x20,0x6c,0x61,0x7a,0x79,0x20,0x64,0x6f,0x67,0x21", as: Data.self, with: decoder) - == Data("The quick brown fox jumped over the lazy dog!".utf8)) - #expect(try decode("VGhl,cXVpY2s=,YnJvd24=,Zm94", as: [Data].self) - == ["The", "quick", "brown", "fox"].map { Data($0.utf8) }) + #expect(try decode("", as: T.self, with: decoder) == T()) + #expect(try decode("1,2,3,4,5,6,7,8", as: T.self, with: decoder) == T([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08])) + #expect(try decode("0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8", as: T.self, with: decoder) == T([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08])) + #expect(try decode("0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08", as: T.self, with: decoder) == T([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08])) + #expect(try decode("0x54,0x68,0x65,0x20,0x71,0x75,0x69,0x63,0x6b,0x20,0x62,0x72,0x6f,0x77,0x6e,0x20,0x66,0x6f,0x78,0x20,0x6a,0x75,0x6d,0x70,0x65,0x64,0x20,0x6f,0x76,0x65,0x72,0x20,0x74,0x68,0x65,0x20,0x6c,0x61,0x7a,0x79,0x20,0x64,0x6f,0x67,0x21", as: T.self, with: decoder) + == T("The quick brown fox jumped over the lazy dog!".utf8)) + #expect(try decode("VGhl,cXVpY2s=,YnJvd24=,Zm94", as: [T].self) + == ["The", "quick", "brown", "fox"].map { T($0.utf8) }) #expect(throws: Swift.DecodingError.self) { - try decode(" ", as: Data.self) + try decode(" ", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("invalid,int,array", as: Data.self) + try decode("invalid,int,array", as: T.self) } #expect(throws: Swift.DecodingError.self) { try decode(nil, as: Data.self) @@ -105,69 +107,71 @@ struct EnvironmentDecoderCustomTypeTests { } @Test func decimalTest() throws { + typealias T = Decimal let formatter = Decimal.FormatStyle(locale: .init(identifier: "")) .precision(.integerAndFractionLength(integerLimits: 1...10, fractionLimits: 0...10)) - #expect(try decode("0", as: Decimal.self).formatted(formatter) == "0") - #expect(try decode("+0", as: Decimal.self).formatted(formatter) == "0") - #expect(try decode("-0", as: Decimal.self).formatted(formatter) == "0") - #expect(try decode("3.1415926", as: Decimal.self).formatted(formatter) == "3.1415926") - #expect(try decode("+3.1415926", as: Decimal.self).formatted(formatter) == "3.1415926") - #expect(try decode("-3.1415926", as: Decimal.self).formatted(formatter) == "-3.1415926") - #expect(try decode("3", as: Decimal.self).formatted(formatter) == "3") - #expect(try decode("+3", as: Decimal.self).formatted(formatter) == "3") - #expect(try decode("-3", as: Decimal.self).formatted(formatter) == "-3") - #expect(try decode("2837.5e-2", as: Decimal.self).formatted(formatter) == "28.375") - #expect(try decode("-2837.5e-2", as: Decimal.self).formatted(formatter) == "-28.375") - #expect(try decode(" 5.0", as: Decimal.self).formatted(formatter) == "5") - #expect(try decode("42degrees", as: Decimal.self).formatted(formatter) == "42") - #expect(try decode(" 1.23", as: Decimal.self).formatted(formatter) == "1.23") - #expect(try decode("1.23 ", as: Decimal.self).formatted(formatter) == "1.23") - #expect(try decode("3,3.14,-3", as: [Decimal].self).map { $0.formatted(formatter) } == ["3", "3.14", "-3"]) + #expect(try decode("0", as: T.self).formatted(formatter) == "0") + #expect(try decode("+0", as: T.self).formatted(formatter) == "0") + #expect(try decode("-0", as: T.self).formatted(formatter) == "0") + #expect(try decode("3.1415926", as: T.self).formatted(formatter) == "3.1415926") + #expect(try decode("+3.1415926", as: T.self).formatted(formatter) == "3.1415926") + #expect(try decode("-3.1415926", as: T.self).formatted(formatter) == "-3.1415926") + #expect(try decode("3", as: T.self).formatted(formatter) == "3") + #expect(try decode("+3", as: T.self).formatted(formatter) == "3") + #expect(try decode("-3", as: T.self).formatted(formatter) == "-3") + #expect(try decode("2837.5e-2", as: T.self).formatted(formatter) == "28.375") + #expect(try decode("-2837.5e-2", as: T.self).formatted(formatter) == "-28.375") + #expect(try decode(" 5.0", as: T.self).formatted(formatter) == "5") + #expect(try decode("42degrees", as: T.self).formatted(formatter) == "42") + #expect(try decode(" 1.23", as: T.self).formatted(formatter) == "1.23") + #expect(try decode("1.23 ", as: T.self).formatted(formatter) == "1.23") + #expect(try decode("3,3.14,-3", as: [T].self).map { $0.formatted(formatter) } == ["3", "3.14", "-3"]) #expect(throws: Swift.DecodingError.self) { - try decode("inf", as: Decimal.self) + try decode("inf", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("infinity", as: Decimal.self) + try decode("infinity", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("nan", as: Decimal.self) + try decode("nan", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("1.23e17802", as: Decimal.self) + try decode("1.23e17802", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("-1.23e17802", as: Decimal.self) + try decode("-1.23e17802", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("±2.0", as: Decimal.self) + try decode("±2.0", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(nil, as: Decimal.self) + try decode(nil, as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("", as: Decimal.self) + try decode("", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("helloworld", as: Decimal.self) + try decode("helloworld", as: T.self) } } @Test func urlTest() throws { - #expect(try decode("https://example.com", as: URL.self).absoluteString == "https://example.com") - #expect(try decode("example.com", as: URL.self).absoluteString == "example.com") - #expect(try decode("a.example.com,b.example.com", as: [URL].self).map(\.absoluteString) == ["a.example.com", "b.example.com"]) + typealias T = URL + #expect(try decode("https://example.com", as: T.self).absoluteString == "https://example.com") + #expect(try decode("example.com", as: T.self).absoluteString == "example.com") + #expect(try decode("a.example.com,b.example.com", as: [T].self).map(\.absoluteString) == ["a.example.com", "b.example.com"]) #expect(throws: Swift.DecodingError.self) { - try decode("", as: URL.self) + try decode("", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(nil, as: URL.self) + try decode(nil, as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(" https://example.com", as: URL.self) + try decode(" https://example.com", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("https://example.com ", as: URL.self) + try decode("https://example.com ", as: T.self) } } } diff --git a/Tests/EnvironmentDecoderTests/EnvironmentDecoderTypeTests.swift b/Tests/EnvironmentDecoderTests/EnvironmentDecoderTypeTests.swift index 90095d0..2efe3ae 100644 --- a/Tests/EnvironmentDecoderTests/EnvironmentDecoderTypeTests.swift +++ b/Tests/EnvironmentDecoderTests/EnvironmentDecoderTypeTests.swift @@ -3,610 +3,624 @@ import Testing struct EnvironmentDecoderTypeTests { @Test func boolTest() throws { - #expect(try decode("true", as: Bool.self) == true) - #expect(try decode("false", as: Bool.self) == false) - #expect(try decode("false,true,false", as: [Bool].self) == [false, true, false]) - #expect(try decode("", as: [Bool].self) == []) + typealias T = Bool + #expect(try decode("true", as: T.self) == true) + #expect(try decode("false", as: T.self) == false) + #expect(try decode("false,true,false", as: [T].self) == [false, true, false]) + #expect(try decode("", as: [T].self) == []) #expect(throws: Swift.DecodingError.self) { - try decode("0", as: Bool.self) + try decode("0", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("1", as: Bool.self) + try decode("1", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("TRUE", as: Bool.self) + try decode("TRUE", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("FALSE", as: Bool.self) + try decode("FALSE", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("True", as: Bool.self) + try decode("True", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("False", as: Bool.self) + try decode("False", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("yes", as: Bool.self) + try decode("yes", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("no", as: Bool.self) + try decode("no", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(nil, as: Bool.self) + try decode(nil, as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("", as: Bool.self) + try decode("", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(" true", as: Bool.self) + try decode(" true", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("true ", as: Bool.self) + try decode("true ", as: T.self) } } @Test func string() throws { - #expect(try decode("abcdef123456", as: String.self) == "abcdef123456") - #expect(try decode("", as: String.self) == "") - #expect(try decode("0", as: String.self) == "0") - #expect(try decode("42", as: String.self) == "42") - #expect(try decode("true", as: String.self) == "true") - #expect(try decode("false", as: String.self) == "false") - #expect(try decode("🤪", as: String.self) == "🤪") - #expect(try decode("\"", as: String.self) == "\"") - #expect(try decode("a,b,c,d,e,f", as: String.self) == "a,b,c,d,e,f") - #expect(try decode(" abcdef123456", as: String.self) == " abcdef123456") - #expect(try decode("a,b,,d,efg", as: [String].self) == ["a", "b", "", "d", "efg"]) - #expect(try decode("", as: [String].self) == []) + typealias T = String + #expect(try decode("abcdef123456", as: T.self) == "abcdef123456") + #expect(try decode("", as: T.self) == "") + #expect(try decode("0", as: T.self) == "0") + #expect(try decode("42", as: T.self) == "42") + #expect(try decode("true", as: T.self) == "true") + #expect(try decode("false", as: T.self) == "false") + #expect(try decode("🤪", as: T.self) == "🤪") + #expect(try decode("\"", as: T.self) == "\"") + #expect(try decode("a,b,c,d,e,f", as: T.self) == "a,b,c,d,e,f") + #expect(try decode(" abcdef123456", as: T.self) == " abcdef123456") + #expect(try decode("a,b,,d,efg", as: [T].self) == ["a", "b", "", "d", "efg"]) + #expect(try decode("", as: [T].self) == []) #expect(throws: Swift.DecodingError.self) { try decode(nil, as: Int.self) } } @Test func double() throws { - #expect(try decode("0", as: Double.self) == 0) - #expect(try decode("+0", as: Double.self) == 0) - #expect(try decode("-0", as: Double.self) == 0) - #expect(try decode("3.1415926", as: Double.self) == 3.1415926) - #expect(try decode("+3.1415926", as: Double.self) == 3.1415926) - #expect(try decode("-3.1415926", as: Double.self) == -3.1415926) - #expect(try decode("3", as: Double.self) == 3) - #expect(try decode("+3", as: Double.self) == 3) - #expect(try decode("-3", as: Double.self) == -3) - #expect(try decode("2837.5e-2", as: Double.self) == 28.375) - #expect(try decode("0x1c.6", as: Double.self) == 28.375) - #expect(try decode("+0x1c.6", as: Double.self) == +28.375) - #expect(try decode("-0x1c.6", as: Double.self) == -28.375) - #expect(try decode("0x1.c6p4", as: Double.self) == 28.375) - #expect(try decode("+0x1.c6p4", as: Double.self) == +28.375) - #expect(try decode("-0x1.c6p4", as: Double.self) == -28.375) - #expect(try decode("inf", as: Double.self) == Double.infinity) - #expect(try decode("infinity", as: Double.self) == Double.infinity) - #expect(try decode("+inf", as: Double.self) == Double.infinity) - #expect(try decode("+infinity", as: Double.self) == Double.infinity) - #expect(try decode("-inf", as: Double.self) == -Double.infinity) - #expect(try decode("-infinity", as: Double.self) == -Double.infinity) - #expect(try decode("nan", as: Double.self).isNaN) - #expect(try decode("+nan", as: Double.self).isNaN) - #expect(try decode("-nan", as: Double.self).isNaN) - #expect(try decode("1.23e17802", as: Double.self) == Double.infinity) - #expect(try decode("-1.23e17802", as: Double.self) == -Double.infinity) - #expect(try decode("3,3.14,-3", as: [Double].self) == [3.0, 3.14, -3.0]) - #expect(try decode("", as: [Double].self) == []) + typealias T = Double + #expect(try decode("0", as: T.self) == 0) + #expect(try decode("+0", as: T.self) == 0) + #expect(try decode("-0", as: T.self) == 0) + #expect(try decode("3.1415926", as: T.self) == 3.1415926) + #expect(try decode("+3.1415926", as: T.self) == 3.1415926) + #expect(try decode("-3.1415926", as: T.self) == -3.1415926) + #expect(try decode("3", as: T.self) == 3) + #expect(try decode("+3", as: T.self) == 3) + #expect(try decode("-3", as: T.self) == -3) + #expect(try decode("2837.5e-2", as: T.self) == 28.375) + #expect(try decode("0x1c.6", as: T.self) == 28.375) + #expect(try decode("+0x1c.6", as: T.self) == +28.375) + #expect(try decode("-0x1c.6", as: T.self) == -28.375) + #expect(try decode("0x1.c6p4", as: T.self) == 28.375) + #expect(try decode("+0x1.c6p4", as: T.self) == +28.375) + #expect(try decode("-0x1.c6p4", as: T.self) == -28.375) + #expect(try decode("inf", as: T.self) == T.infinity) + #expect(try decode("infinity", as: T.self) == T.infinity) + #expect(try decode("+inf", as: T.self) == T.infinity) + #expect(try decode("+infinity", as: T.self) == T.infinity) + #expect(try decode("-inf", as: T.self) == -T.infinity) + #expect(try decode("-infinity", as: T.self) == -T.infinity) + #expect(try decode("nan", as: T.self).isNaN) + #expect(try decode("+nan", as: T.self).isNaN) + #expect(try decode("-nan", as: T.self).isNaN) + #expect(try decode("1.23e17802", as: T.self) == T.infinity) + #expect(try decode("-1.23e17802", as: T.self) == -T.infinity) + #expect(try decode("3,3.14,-3", as: [T].self) == [3.0, 3.14, -3.0]) + #expect(try decode("", as: [T].self) == []) #expect(throws: Swift.DecodingError.self) { - try decode(" 5.0", as: Double.self) + try decode(" 5.0", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("±2.0", as: Double.self) + try decode("±2.0", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(nil, as: Double.self) + try decode(nil, as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("", as: Double.self) + try decode("", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("helloworld", as: Double.self) + try decode("helloworld", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("42degrees", as: Double.self) + try decode("42degrees", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(" 1.23", as: Double.self) + try decode(" 1.23", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("1.23 ", as: Double.self) + try decode("1.23 ", as: T.self) } } @Test func float() throws { - #expect(try decode("0", as: Float.self) == 0) - #expect(try decode("+0", as: Float.self) == 0) - #expect(try decode("-0", as: Float.self) == 0) - #expect(try decode("3.1415926", as: Float.self) == 3.1415926) - #expect(try decode("+3.1415926", as: Float.self) == 3.1415926) - #expect(try decode("-3.1415926", as: Float.self) == -3.1415926) - #expect(try decode("3", as: Float.self) == 3) - #expect(try decode("+3", as: Float.self) == 3) - #expect(try decode("-3", as: Float.self) == -3) - #expect(try decode("2837.5e-2", as: Float.self) == 28.375) - #expect(try decode("0x1c.6", as: Float.self) == 28.375) - #expect(try decode("+0x1c.6", as: Float.self) == +28.375) - #expect(try decode("-0x1c.6", as: Float.self) == -28.375) - #expect(try decode("0x1.c6p4", as: Float.self) == 28.375) - #expect(try decode("+0x1.c6p4", as: Float.self) == +28.375) - #expect(try decode("-0x1.c6p4", as: Float.self) == -28.375) - #expect(try decode("inf", as: Float.self) == Float.infinity) - #expect(try decode("infinity", as: Float.self) == Float.infinity) - #expect(try decode("+inf", as: Float.self) == Float.infinity) - #expect(try decode("+infinity", as: Float.self) == Float.infinity) - #expect(try decode("-inf", as: Float.self) == -Float.infinity) - #expect(try decode("-infinity", as: Float.self) == -Float.infinity) - #expect(try decode("nan", as: Float.self).isNaN) - #expect(try decode("+nan", as: Float.self).isNaN) - #expect(try decode("-nan", as: Float.self).isNaN) - #expect(try decode("1.23e17802", as: Float.self) == Float.infinity) - #expect(try decode("-1.23e17802", as: Float.self) == -Float.infinity) - #expect(try decode("3,3.14,-3", as: [Float].self) == [3.0, 3.14, -3.0]) - #expect(try decode("", as: [Float].self) == []) + typealias T = Float + #expect(try decode("0", as: T.self) == 0) + #expect(try decode("+0", as: T.self) == 0) + #expect(try decode("-0", as: T.self) == 0) + #expect(try decode("3.1415926", as: T.self) == 3.1415926) + #expect(try decode("+3.1415926", as: T.self) == 3.1415926) + #expect(try decode("-3.1415926", as: T.self) == -3.1415926) + #expect(try decode("3", as: T.self) == 3) + #expect(try decode("+3", as: T.self) == 3) + #expect(try decode("-3", as: T.self) == -3) + #expect(try decode("2837.5e-2", as: T.self) == 28.375) + #expect(try decode("0x1c.6", as: T.self) == 28.375) + #expect(try decode("+0x1c.6", as: T.self) == +28.375) + #expect(try decode("-0x1c.6", as: T.self) == -28.375) + #expect(try decode("0x1.c6p4", as: T.self) == 28.375) + #expect(try decode("+0x1.c6p4", as: T.self) == +28.375) + #expect(try decode("-0x1.c6p4", as: T.self) == -28.375) + #expect(try decode("inf", as: T.self) == T.infinity) + #expect(try decode("infinity", as: T.self) == T.infinity) + #expect(try decode("+inf", as: T.self) == T.infinity) + #expect(try decode("+infinity", as: T.self) == T.infinity) + #expect(try decode("-inf", as: T.self) == -T.infinity) + #expect(try decode("-infinity", as: T.self) == -T.infinity) + #expect(try decode("nan", as: T.self).isNaN) + #expect(try decode("+nan", as: T.self).isNaN) + #expect(try decode("-nan", as: T.self).isNaN) + #expect(try decode("1.23e17802", as: T.self) == T.infinity) + #expect(try decode("-1.23e17802", as: T.self) == -T.infinity) + #expect(try decode("3,3.14,-3", as: [T].self) == [3.0, 3.14, -3.0]) + #expect(try decode("", as: [T].self) == []) #expect(throws: Swift.DecodingError.self) { - try decode(" 5.0", as: Float.self) + try decode(" 5.0", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("±2.0", as: Float.self) + try decode("±2.0", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(nil, as: Float.self) + try decode(nil, as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("", as: Float.self) + try decode("", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("helloworld", as: Float.self) + try decode("helloworld", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("42degrees", as: Float.self) + try decode("42degrees", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(" 1.23", as: Float.self) + try decode(" 1.23", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("1.23 ", as: Float.self) + try decode("1.23 ", as: T.self) } } @Test func int() throws { - #expect(try decode("0", as: Int.self) == 0) - #expect(try decode("123456", as: Int.self) == 123_456) - #expect(try decode("-123456", as: Int.self) == -123_456) - #expect(try decode("1,23,456", as: [Int].self) == [1, 23, 456]) - #expect(try decode("", as: [Int].self) == []) + typealias T = Int + #expect(try decode("0", as: T.self) == 0) + #expect(try decode("123456", as: T.self) == 123_456) + #expect(try decode("-123456", as: T.self) == -123_456) + #expect(try decode("1,23,456", as: [T].self) == [1, 23, 456]) + #expect(try decode("", as: [T].self) == []) #expect(throws: Swift.DecodingError.self) { - try decode("123.456", as: Int.self) + try decode("123.456", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(nil, as: Int.self) + try decode(nil, as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("", as: Int.self) + try decode("", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("9223372036854775808", as: Int.self) // overflow + try decode("9223372036854775808", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("-9223372036854775809", as: Int.self) // overflow + try decode("-9223372036854775809", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("helloworld", as: Int.self) + try decode("helloworld", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("42degrees", as: Int.self) + try decode("42degrees", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(" 123456", as: Int.self) + try decode(" 123456", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("123456 ", as: Int.self) + try decode("123456 ", as: T.self) } } @Test func int8() throws { - #expect(try decode("0", as: Int8.self) == 0) - #expect(try decode("27", as: Int8.self) == 27) - #expect(try decode("-27", as: Int8.self) == -27) - #expect(try decode("1,23,45", as: [Int8].self) == [1, 23, 45]) - #expect(try decode("", as: [Int8].self) == []) + typealias T = Int8 + #expect(try decode("0", as: T.self) == 0) + #expect(try decode("27", as: T.self) == 27) + #expect(try decode("-27", as: T.self) == -27) + #expect(try decode("1,23,45", as: [T].self) == [1, 23, 45]) + #expect(try decode("", as: [T].self) == []) #expect(throws: Swift.DecodingError.self) { - try decode("27.5", as: Int8.self) + try decode("27.5", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(nil, as: Int8.self) + try decode(nil, as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("", as: Int8.self) + try decode("", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("129", as: Int8.self) // overflow + try decode("129", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("-129", as: Int8.self) // overflow + try decode("-129", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("helloworld", as: Int8.self) + try decode("helloworld", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("42degrees", as: Int8.self) + try decode("42degrees", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(" 27", as: Int8.self) + try decode(" 27", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("27 ", as: Int8.self) + try decode("27 ", as: T.self) } } @Test func int16() throws { - #expect(try decode("0", as: Int16.self) == 0) - #expect(try decode("1234", as: Int16.self) == 1234) - #expect(try decode("-1234", as: Int16.self) == -1234) - #expect(try decode("1,23,456", as: [Int16].self) == [1, 23, 456]) - #expect(try decode("", as: [Int16].self) == []) + typealias T = Int16 + #expect(try decode("0", as: T.self) == 0) + #expect(try decode("1234", as: T.self) == 1234) + #expect(try decode("-1234", as: T.self) == -1234) + #expect(try decode("1,23,456", as: [T].self) == [1, 23, 456]) + #expect(try decode("", as: [T].self) == []) #expect(throws: Swift.DecodingError.self) { - try decode("1234.5", as: Int16.self) + try decode("1234.5", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(nil, as: Int16.self) + try decode(nil, as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("", as: Int16.self) + try decode("", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("32768", as: Int16.self) // overflow + try decode("32768", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("-32769", as: Int16.self) // overflow + try decode("-32769", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("helloworld", as: Int16.self) + try decode("helloworld", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("42degrees", as: Int16.self) + try decode("42degrees", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(" 1234", as: Int16.self) + try decode(" 1234", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("1234 ", as: Int16.self) + try decode("1234 ", as: T.self) } } @Test func int32() throws { - #expect(try decode("0", as: Int32.self) == 0) - #expect(try decode("123456", as: Int32.self) == 123_456) - #expect(try decode("-123456", as: Int32.self) == -123_456) - #expect(try decode("1,23,456", as: [Int32].self) == [1, 23, 456]) - #expect(try decode("", as: [Int32].self) == []) + typealias T = Int32 + #expect(try decode("0", as: T.self) == 0) + #expect(try decode("123456", as: T.self) == 123_456) + #expect(try decode("-123456", as: T.self) == -123_456) + #expect(try decode("1,23,456", as: [T].self) == [1, 23, 456]) + #expect(try decode("", as: [T].self) == []) #expect(throws: Swift.DecodingError.self) { - try decode("123456.78", as: Int32.self) + try decode("123456.78", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(nil, as: Int32.self) + try decode(nil, as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("", as: Int32.self) + try decode("", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("2147483648", as: Int32.self) // overflow + try decode("2147483648", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("-2147483649", as: Int32.self) // overflow + try decode("-2147483649", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("helloworld", as: Int32.self) + try decode("helloworld", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("42degrees", as: Int32.self) + try decode("42degrees", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(" 123456", as: Int32.self) + try decode(" 123456", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("123456 ", as: Int32.self) + try decode("123456 ", as: T.self) } } @Test func int64() throws { - #expect(try decode("0", as: Int64.self) == 0) - #expect(try decode("123456", as: Int64.self) == 123_456) - #expect(try decode("-123456", as: Int64.self) == -123_456) - #expect(try decode("1,23,456", as: [Int64].self) == [1, 23, 456]) - #expect(try decode("", as: [Int64].self) == []) + typealias T = Int64 + #expect(try decode("0", as: T.self) == 0) + #expect(try decode("123456", as: T.self) == 123_456) + #expect(try decode("-123456", as: T.self) == -123_456) + #expect(try decode("1,23,456", as: [T].self) == [1, 23, 456]) + #expect(try decode("", as: [T].self) == []) #expect(throws: Swift.DecodingError.self) { - try decode("123456.78", as: Int64.self) + try decode("123456.78", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(nil, as: Int64.self) + try decode(nil, as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("", as: Int64.self) + try decode("", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("9223372036854775808", as: Int64.self) // overflow + try decode("9223372036854775808", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("-9223372036854775809", as: Int64.self) // overflow + try decode("-9223372036854775809", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("helloworld", as: Int64.self) + try decode("helloworld", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("42degrees", as: Int64.self) + try decode("42degrees", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(" 123456", as: Int64.self) + try decode(" 123456", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("123456 ", as: Int64.self) + try decode("123456 ", as: T.self) } } @Test func uint() throws { - #expect(try decode("0", as: UInt.self) == 0) - #expect(try decode("123456", as: UInt.self) == 123_456) - #expect(try decode("0x00", as: UInt.self) == 0) - #expect(try decode("0x1", as: UInt.self) == 1) - #expect(try decode("0x01", as: UInt.self) == 1) - #expect(try decode("0x00000000000000001", as: UInt.self) == 1) - #expect(try decode("0xe000000000000000", as: UInt.self) == 16_140_901_064_495_857_664) - #expect(try decode("0xFFFFFFFFFFFFFFFF", as: UInt.self) == 18_446_744_073_709_551_615) - #expect(try decode("1,23,456", as: [UInt].self) == [1, 23, 456]) - #expect(try decode("", as: [UInt].self) == []) + typealias T = UInt + #expect(try decode("0", as: T.self) == 0) + #expect(try decode("123456", as: T.self) == 123_456) + #expect(try decode("0x00", as: T.self) == 0) + #expect(try decode("0x1", as: T.self) == 1) + #expect(try decode("0x01", as: T.self) == 1) + #expect(try decode("0x00000000000000001", as: T.self) == 1) + #expect(try decode("0xe000000000000000", as: T.self) == 16_140_901_064_495_857_664) + #expect(try decode("0xFFFFFFFFFFFFFFFF", as: T.self) == 18_446_744_073_709_551_615) + #expect(try decode("1,23,456", as: [T].self) == [1, 23, 456]) + #expect(try decode("", as: [T].self) == []) #expect(throws: Swift.DecodingError.self) { - try decode("-123456", as: UInt.self) + try decode("-123456", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("123456.78", as: UInt.self) + try decode("123456.78", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(nil, as: UInt.self) + try decode(nil, as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("", as: UInt.self) + try decode("", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("18446744073709551616", as: UInt.self) // overflow + try decode("18446744073709551616", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("0x10000000000000000", as: UInt.self) // overflow + try decode("0x10000000000000000", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("0x", as: UInt.self) + try decode("0x", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("0xx", as: UInt.self) + try decode("0xx", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("0xhello", as: UInt.self) + try decode("0xhello", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("helloworld", as: UInt.self) + try decode("helloworld", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("42degrees", as: UInt.self) + try decode("42degrees", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(" 123456", as: UInt.self) + try decode(" 123456", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("123456 ", as: UInt.self) + try decode("123456 ", as: T.self) } } @Test func uint8() throws { - #expect(try decode("0", as: UInt8.self) == 0) - #expect(try decode("27", as: UInt8.self) == 27) - #expect(try decode("0x00", as: UInt8.self) == 0) - #expect(try decode("0x1", as: UInt8.self) == 1) - #expect(try decode("0x01", as: UInt8.self) == 1) - #expect(try decode("0x001", as: UInt8.self) == 1) - #expect(try decode("0xe0", as: UInt8.self) == 224) - #expect(try decode("0xFF", as: UInt8.self) == 255) - #expect(try decode("1,23,45", as: [UInt8].self) == [1, 23, 45]) - #expect(try decode("", as: [UInt8].self) == []) + typealias T = UInt8 + #expect(try decode("0", as: T.self) == 0) + #expect(try decode("27", as: T.self) == 27) + #expect(try decode("0x00", as: T.self) == 0) + #expect(try decode("0x1", as: T.self) == 1) + #expect(try decode("0x01", as: T.self) == 1) + #expect(try decode("0x001", as: T.self) == 1) + #expect(try decode("0xe0", as: T.self) == 224) + #expect(try decode("0xFF", as: T.self) == 255) + #expect(try decode("1,23,45", as: [T].self) == [1, 23, 45]) + #expect(try decode("", as: [T].self) == []) #expect(throws: Swift.DecodingError.self) { - try decode("-27", as: UInt8.self) + try decode("-27", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("27.5", as: UInt8.self) + try decode("27.5", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(nil, as: UInt8.self) + try decode(nil, as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("", as: UInt8.self) + try decode("", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("256", as: UInt8.self) // overflow + try decode("256", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("0x100", as: UInt8.self) // overflow + try decode("0x100", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("0x", as: UInt8.self) + try decode("0x", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("0xx", as: UInt8.self) + try decode("0xx", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("0xhello", as: UInt8.self) + try decode("0xhello", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("helloworld", as: UInt8.self) + try decode("helloworld", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("42degrees", as: UInt8.self) + try decode("42degrees", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(" 27", as: UInt8.self) + try decode(" 27", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("27 ", as: UInt8.self) + try decode("27 ", as: T.self) } } @Test func uint16() throws { - #expect(try decode("0", as: UInt16.self) == 0) - #expect(try decode("1234", as: UInt16.self) == 1234) - #expect(try decode("0x00", as: UInt16.self) == 0) - #expect(try decode("0x1", as: UInt16.self) == 1) - #expect(try decode("0x01", as: UInt16.self) == 1) - #expect(try decode("0x00001", as: UInt16.self) == 1) - #expect(try decode("0xe000", as: UInt16.self) == 57344) - #expect(try decode("0xFFFF", as: UInt16.self) == 65535) - #expect(try decode("1,23,456", as: [UInt16].self) == [1, 23, 456]) - #expect(try decode("", as: [UInt16].self) == []) + typealias T = UInt16 + #expect(try decode("0", as: T.self) == 0) + #expect(try decode("1234", as: T.self) == 1234) + #expect(try decode("0x00", as: T.self) == 0) + #expect(try decode("0x1", as: T.self) == 1) + #expect(try decode("0x01", as: T.self) == 1) + #expect(try decode("0x00001", as: T.self) == 1) + #expect(try decode("0xe000", as: T.self) == 57344) + #expect(try decode("0xFFFF", as: T.self) == 65535) + #expect(try decode("1,23,456", as: [T].self) == [1, 23, 456]) + #expect(try decode("", as: [T].self) == []) #expect(throws: Swift.DecodingError.self) { - try decode("-1234", as: UInt16.self) + try decode("-1234", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("1234.5", as: UInt16.self) + try decode("1234.5", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(nil, as: UInt16.self) + try decode(nil, as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("", as: UInt16.self) + try decode("", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("65536", as: UInt16.self) // overflow + try decode("65536", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("0x10000", as: UInt16.self) // overflow + try decode("0x10000", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("0x", as: UInt16.self) + try decode("0x", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("0xx", as: UInt16.self) + try decode("0xx", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("0xhello", as: UInt16.self) + try decode("0xhello", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("helloworld", as: UInt16.self) + try decode("helloworld", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("42degrees", as: UInt16.self) + try decode("42degrees", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(" 1234", as: UInt16.self) + try decode(" 1234", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("1234 ", as: UInt16.self) + try decode("1234 ", as: T.self) } } @Test func uint32() throws { - #expect(try decode("0", as: UInt32.self) == 0) - #expect(try decode("123456", as: UInt32.self) == 123_456) - #expect(try decode("0x00", as: UInt32.self) == 0) - #expect(try decode("0x1", as: UInt32.self) == 1) - #expect(try decode("0x01", as: UInt32.self) == 1) - #expect(try decode("0x000000001", as: UInt32.self) == 1) - #expect(try decode("0xe0000000", as: UInt32.self) == 3_758_096_384) - #expect(try decode("0xFFFFFFFF", as: UInt32.self) == 4_294_967_295) - #expect(try decode("1,23,456", as: [UInt32].self) == [1, 23, 456]) - #expect(try decode("", as: [UInt32].self) == []) + typealias T = UInt32 + #expect(try decode("0", as: T.self) == 0) + #expect(try decode("123456", as: T.self) == 123_456) + #expect(try decode("0x00", as: T.self) == 0) + #expect(try decode("0x1", as: T.self) == 1) + #expect(try decode("0x01", as: T.self) == 1) + #expect(try decode("0x000000001", as: T.self) == 1) + #expect(try decode("0xe0000000", as: T.self) == 3_758_096_384) + #expect(try decode("0xFFFFFFFF", as: T.self) == 4_294_967_295) + #expect(try decode("1,23,456", as: [T].self) == [1, 23, 456]) + #expect(try decode("", as: [T].self) == []) #expect(throws: Swift.DecodingError.self) { - try decode("-123456", as: UInt32.self) + try decode("-123456", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("123456.78", as: UInt32.self) + try decode("123456.78", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(nil, as: UInt32.self) + try decode(nil, as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("", as: UInt32.self) + try decode("", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("4294967296", as: UInt32.self) // overflow + try decode("4294967296", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("0x100000000", as: UInt32.self) // overflow + try decode("0x100000000", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("0x", as: UInt32.self) + try decode("0x", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("0xx", as: UInt32.self) + try decode("0xx", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("0xhello", as: UInt32.self) + try decode("0xhello", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("helloworld", as: UInt32.self) + try decode("helloworld", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("42degrees", as: UInt32.self) + try decode("42degrees", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(" 123456", as: UInt32.self) + try decode(" 123456", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("123456 ", as: UInt32.self) + try decode("123456 ", as: T.self) } } @Test func uint64() throws { - #expect(try decode("0", as: UInt64.self) == 0) - #expect(try decode("123456", as: UInt64.self) == 123_456) - #expect(try decode("0x00", as: UInt64.self) == 0) - #expect(try decode("0x1", as: UInt64.self) == 1) - #expect(try decode("0x01", as: UInt64.self) == 1) - #expect(try decode("0x00000000000000001", as: UInt64.self) == 1) - #expect(try decode("0xe000000000000000", as: UInt64.self) == 16_140_901_064_495_857_664) - #expect(try decode("0xFFFFFFFFFFFFFFFF", as: UInt64.self) == 18_446_744_073_709_551_615) - #expect(try decode("1,23,456", as: [UInt64].self) == [1, 23, 456]) - #expect(try decode("", as: [UInt64].self) == []) + typealias T = UInt64 + #expect(try decode("0", as: T.self) == 0) + #expect(try decode("123456", as: T.self) == 123_456) + #expect(try decode("0x00", as: T.self) == 0) + #expect(try decode("0x1", as: T.self) == 1) + #expect(try decode("0x01", as: T.self) == 1) + #expect(try decode("0x00000000000000001", as: T.self) == 1) + #expect(try decode("0xe000000000000000", as: T.self) == 16_140_901_064_495_857_664) + #expect(try decode("0xFFFFFFFFFFFFFFFF", as: T.self) == 18_446_744_073_709_551_615) + #expect(try decode("1,23,456", as: [T].self) == [1, 23, 456]) + #expect(try decode("", as: [T].self) == []) #expect(throws: Swift.DecodingError.self) { - try decode("-123456", as: UInt64.self) + try decode("-123456", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("123456.78", as: UInt64.self) + try decode("123456.78", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(nil, as: UInt64.self) + try decode(nil, as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("", as: UInt64.self) + try decode("", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("18446744073709551616", as: UInt64.self) // overflow + try decode("18446744073709551616", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("0x10000000000000000", as: UInt64.self) // overflow + try decode("0x10000000000000000", as: T.self) // overflow } #expect(throws: Swift.DecodingError.self) { - try decode("0x", as: UInt64.self) + try decode("0x", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("0xx", as: UInt64.self) + try decode("0xx", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("0xhello", as: UInt64.self) + try decode("0xhello", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("helloworld", as: UInt64.self) + try decode("helloworld", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("42degrees", as: UInt64.self) + try decode("42degrees", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode(" 123456", as: UInt64.self) + try decode(" 123456", as: T.self) } #expect(throws: Swift.DecodingError.self) { - try decode("123456 ", as: UInt64.self) + try decode("123456 ", as: T.self) } } }