Skip to content

Commit ea0b9fc

Browse files
authored
Merge pull request #22 from tayloraswift/test-lowering-deployment-minima
check if we can get away with keeping the old deployment minima
2 parents 5550cee + 1df651d commit ea0b9fc

File tree

3 files changed

+84
-33
lines changed

3 files changed

+84
-33
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import PackageDescription
33

44
let package:Package = .init(
55
name: "swift-hash",
6-
platforms: [.macOS(.v14), .iOS(.v17), .tvOS(.v17), .visionOS(.v1), .watchOS(.v10)],
6+
platforms: [.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6)],
77
products: [
88
.library(name: "Base16", targets: ["Base16"]),
99
.library(name: "Base64", targets: ["Base64"]),

Sources/MD5Tests/Hashing.swift

Lines changed: 68 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,80 @@ import Testing
55
@Suite
66
struct Hashing
77
{
8-
@Test(arguments: [
9-
(0xd41d8cd98f00b204e9800998ecf8427e, []),
10-
(0x0cc175b9c0f1b6a831c399e269772661, [0x61]),
11-
(0x900150983cd24fb0d6963f7d28e17f72, [0x61, 0x62, 0x63]),
12-
] as [(MD5, [UInt8])])
8+
private
9+
static var binary:[(MD5, [UInt8])]
10+
{
11+
if #available(
12+
macOS 13.3,
13+
macCatalyst 16.4,
14+
iOS 16.4,
15+
tvOS 16.4,
16+
visionOS 1.0,
17+
watchOS 9.4,
18+
*)
19+
{
20+
[
21+
(0xd41d8cd98f00b204e9800998ecf8427e, []),
22+
(0x0cc175b9c0f1b6a831c399e269772661, [0x61]),
23+
(0x900150983cd24fb0d6963f7d28e17f72, [0x61, 0x62, 0x63]),
24+
]
25+
}
26+
else
27+
{
28+
[]
29+
}
30+
}
31+
32+
@Test(arguments: Self.binary)
1333
static func binary(_ test:(expected:MD5, input:[UInt8]))
1434
{
1535
let md5:MD5 = .init(hashing: test.input)
1636
#expect(md5 == test.expected)
1737
}
1838

19-
@Test(arguments: [
20-
(
21-
0xf96b697d7cb7938d525a2f31aaf161d0,
22-
"message digest"
23-
),
24-
(
25-
0xc3fcd3d76192e4007dfb496cca67e13b,
26-
"abcdefghijklmnopqrstuvwxyz"
27-
),
28-
(
29-
0xd174ab98d277d9f5a5611c2c9f419d9f,
30-
"""
31-
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
32-
"""
33-
),
34-
(
35-
0x57edf4a22be3c955ac49da2e2107b67a,
36-
"""
37-
12345678901234567890123456789012345678901234567890123456789012345678901234567890
38-
"""
39-
),
40-
] as [(MD5, String)])
39+
private
40+
static var string:[(MD5, String)]
41+
{
42+
if #available(
43+
macOS 13.3,
44+
macCatalyst 16.4,
45+
iOS 16.4,
46+
tvOS 16.4,
47+
visionOS 1.0,
48+
watchOS 9.4,
49+
*)
50+
{
51+
[
52+
(
53+
0xf96b697d7cb7938d525a2f31aaf161d0,
54+
"message digest"
55+
),
56+
(
57+
0xc3fcd3d76192e4007dfb496cca67e13b,
58+
"abcdefghijklmnopqrstuvwxyz"
59+
),
60+
(
61+
0xd174ab98d277d9f5a5611c2c9f419d9f,
62+
"""
63+
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
64+
"""
65+
),
66+
(
67+
0x57edf4a22be3c955ac49da2e2107b67a,
68+
"""
69+
1234567890123456789012345678901234567890\
70+
1234567890123456789012345678901234567890
71+
"""
72+
),
73+
]
74+
}
75+
else
76+
{
77+
[]
78+
}
79+
}
80+
81+
@Test(arguments: Self.string)
4182
static func string(_ test:(expected:MD5, input:String))
4283
{
4384
let md5:MD5 = .init(hashing: test.input.utf8)

Sources/MD5Tests/ParsingAndFormatting.swift

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,21 @@ struct ParsingAndFormatting
77
@Test
88
static func strings() throws
99
{
10-
let string:String = "d41d8cd98f00b204e9800998ecf8427e"
11-
let hash:MD5 = 0xd41d8cd98f00b204e9800998ecf8427e
10+
if #available(
11+
macOS 13.3,
12+
macCatalyst 16.4,
13+
iOS 16.4,
14+
tvOS 16.4,
15+
visionOS 1.0,
16+
watchOS 9.4,
17+
*)
18+
{
19+
let string:String = "d41d8cd98f00b204e9800998ecf8427e"
20+
let hash:MD5 = 0xd41d8cd98f00b204e9800998ecf8427e
1221

13-
let parsed:MD5 = try #require(.init(string))
14-
#expect(parsed == hash)
15-
#expect(string == "\(hash)")
22+
let parsed:MD5 = try #require(.init(string))
23+
#expect(parsed == hash)
24+
#expect(string == "\(hash)")
25+
}
1626
}
1727
}

0 commit comments

Comments
 (0)