37 lines
851 B
Swift
37 lines
851 B
Swift
|
import Testing
|
||
|
@testable import aoc2022
|
||
|
|
||
|
@Suite("Day 2") struct Day02Test {
|
||
|
@Test("Part 1 Test") func testPart1() {
|
||
|
let input = """
|
||
|
A Y
|
||
|
B X
|
||
|
C Z
|
||
|
"""
|
||
|
let out = Day02.part1(input)
|
||
|
#expect(out == 15)
|
||
|
}
|
||
|
|
||
|
@Test("Part 1 actual") func runPart1() throws {
|
||
|
let input = try String(contentsOfFile: "Input/day02.txt")
|
||
|
let out = Day02.part1(input)
|
||
|
#expect(out == 12740)
|
||
|
}
|
||
|
|
||
|
@Test("Part 2 Test") func testPart2() {
|
||
|
let input = """
|
||
|
A Y
|
||
|
B X
|
||
|
C Z
|
||
|
"""
|
||
|
let out = Day02.part2(input)
|
||
|
#expect(out == 12)
|
||
|
}
|
||
|
|
||
|
@Test("Part 2 actual") func runPart2() throws {
|
||
|
let input = try String(contentsOfFile: "Input/day02.txt")
|
||
|
let out = Day02.part2(input)
|
||
|
#expect(out == 11980)
|
||
|
}
|
||
|
}
|