aoc2022/Tests/aoc2022Tests/day02.swift

37 lines
851 B
Swift
Raw Permalink Normal View History

2024-08-18 12:14:40 -05:00
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)
}
}