Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit c015c65

Browse files
author
Charlotte Tortorella
committed
Refactor zip.map to zipWith
1 parent 9255831 commit c015c65

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Tests/FreeLiterals.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@ let whitespacesAndNewlines: Set<UnicodeScalar> = [
2121
let allNumbers = UnicodeScalar.arbitrary.suchThat(CharacterSet(charactersIn: "0"..."9").contains).proliferate.string
2222

2323
let integers = Gen.one(of: [
24-
Gen.zip(UnicodeScalar.arbitrary.suchThat(CharacterSet(charactersIn: "1"..."9").contains).map { String(Character($0)) }, .frequency([(3, allNumbers), (1, .pure(""))])).map(+),
24+
.zipWith(
25+
Gen.fromElements(of: UnicodeScalar.allScalars(from: "1", through: "9")).map { String(Character($0)) },
26+
.frequency([(3, allNumbers), (1, .pure(""))]),
27+
transform: +
28+
),
2529
.pure("0")
26-
]
27-
)
30+
])
2831

2932
let jsonNumbers: Gen<[String]> = .compose { c in
3033
let minus = Gen<String>.fromElements(of: ["-", ""])

0 commit comments

Comments
 (0)