-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestTemplate.swift
More file actions
46 lines (37 loc) · 1.1 KB
/
Copy pathtestTemplate.swift
File metadata and controls
46 lines (37 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import utils
import XCTest
final class aocTests: XCTestCase {
func testPart1Sample() async throws {
let actual = try await Solution.solve("sample.txt")
XCTAssertEqual(actual, -1)
}
func testPart1Real() async throws {
let actual = try await Solution.solve("real.txt")
XCTAssertEqual(actual, -1)
}
func testPart2Sample() async throws {
let actual = try await Solution.solve("sample.txt")
XCTAssertEqual(actual, -1)
}
func testPart2Real() async throws {
let actual = try await Solution.solve("real.txt")
XCTAssertEqual(actual, -1)
}
}
// MARK: - Solution
enum Solution {
static func solve(
_ fileName: String
) async throws -> Int {
guard let fileURL = Bundle.module.url(forResource: fileName, withExtension: nil) else {
throw StringParsingError("Unable to open \(fileName)")
}
for line in try String.lines(fromFile: fileURL) {
guard !line.isEmpty else {
continue
}
}
return Int.max
}
}
// MARK: - Structures