init
This commit is contained in:
66
Tests/aoc2022Tests/day01.swift
Normal file
66
Tests/aoc2022Tests/day01.swift
Normal file
@@ -0,0 +1,66 @@
|
||||
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")
|
||||
}
|
||||
}
|
36
Tests/aoc2022Tests/day02.swift
Normal file
36
Tests/aoc2022Tests/day02.swift
Normal file
@@ -0,0 +1,36 @@
|
||||
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)
|
||||
}
|
||||
}
|
23
Tests/aoc2022Tests/day03.swift
Normal file
23
Tests/aoc2022Tests/day03.swift
Normal file
@@ -0,0 +1,23 @@
|
||||
import Testing
|
||||
@testable import aoc2022
|
||||
|
||||
@Suite("Day 3 Tests") struct Day03Test {
|
||||
@Test("Part 1 Test") func testPart1() {
|
||||
let input = """
|
||||
vJrwpWtwJgWrhcsFMMfFFhFp
|
||||
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
|
||||
PmmdzqPrVvPwwTWBwg
|
||||
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
|
||||
ttgJtRGJQctTZtZT
|
||||
CrZsJsPPZsGzwwsLwLmpwMDw
|
||||
"""
|
||||
let out = Day03.part1(input)
|
||||
#expect(out == 157)
|
||||
}
|
||||
|
||||
@Test("Part 1 Actual") func runPart1() throws {
|
||||
let input = try String(contentsOfFile: "Input/day03.txt")
|
||||
let out = Day03.part1(input)
|
||||
#expect(out == 8176)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user