aoc2022/Tests/aoc2022Tests/day01.swift

67 lines
1.3 KiB
Swift
Raw Normal View History

2024-08-18 12:14:40 -05:00
import Testing
@testable import aoc2022
@Suite("Day 1 Tests") struct Day01Tests {
@Test("Part 1 Test") func testPart1() {
let input = """
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
"""
let out = Day01.part1(input)
#expect(24000 == out, "\(out) should be 24000")
}
@Test("Part 1 Actual") func runPart1() throws {
let input = try String(contentsOfFile: "Input/day01.txt", encoding: .utf8)
let out = Day01.part1(input)
#expect(67016 == out, "\(out) should be 67016")
}
@Test("Part 2 Test") func testPart2() {
let input = """
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
"""
let out = Day01.part2(input)
#expect(45000 == out, "\(out) should be 45000")
}
@Test("Part 2 Actual") func runPart2() throws {
let input = try String(contentsOfFile: "Input/day01.txt", encoding: .utf8)
let out = Day01.part2(input)
#expect(200116 == out, "\(out) should be 200116")
}
}