@@ -5,39 +5,80 @@ import Testing
55@Suite
66struct 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)
0 commit comments