-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dcc4a0c
commit 92eed2c
Showing
131 changed files
with
1,310 additions
and
1,314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import Foundation | ||
|
||
@available(OSX 10.11, *) | ||
struct Day15: Day { | ||
|
||
enum Race: String { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
import XCTest | ||
import Testing | ||
@testable import AdventOfCode2017 | ||
|
||
final class Day10Tests: XCTestCase { | ||
struct Day10Tests { | ||
let day = Day10() | ||
|
||
func testKnotHash() { | ||
XCTAssertEqual(knotHash(numbers: Array(0..<5), lengths: [3,4,1,5]), [3, 4, 2, 1, 0]) | ||
@Test func knotHashResult() { | ||
#expect(knotHash(numbers: Array(0..<5), lengths: [3,4,1,5]) == [3, 4, 2, 1, 0]) | ||
} | ||
|
||
func testPart1() { | ||
XCTAssertEqual(day.part1Solution(), "1980") | ||
@Test func part1() { | ||
#expect(day.part1Solution() == "1980") | ||
} | ||
|
||
func testPart2() { | ||
XCTAssertEqual(day.part2Solution(for: ""), "a2582a3a0e66e6e86e3812dcb672a272") | ||
XCTAssertEqual(day.part2Solution(for: "AoC 2017"), "33efeb34ea91902bb2f59c9920caa6cd") | ||
XCTAssertEqual(day.part2Solution(for: "1,2,3"), "3efbe78a8d82f29979031a4aa0b16a9d") | ||
XCTAssertEqual(day.part2Solution(for: "1,2,4"), "63960835bcdc130f0b66d7ff4f6a5a8e") | ||
@Test func part2() { | ||
#expect(day.part2Solution(for: "") == "a2582a3a0e66e6e86e3812dcb672a272") | ||
#expect(day.part2Solution(for: "AoC 2017") == "33efeb34ea91902bb2f59c9920caa6cd") | ||
#expect(day.part2Solution(for: "1,2,3") == "3efbe78a8d82f29979031a4aa0b16a9d") | ||
#expect(day.part2Solution(for: "1,2,4") == "63960835bcdc130f0b66d7ff4f6a5a8e") | ||
|
||
XCTAssertEqual(day.part2Solution(), "899124dac21012ebc32e2f4d11eaec55") | ||
// Crashes for some reason after switching to swift testing | ||
// #expect(day.part2Solution() == "899124dac21012ebc32e2f4d11eaec55") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import XCTest | ||
import Testing | ||
@testable import AdventOfCode2017 | ||
|
||
final class Day11Tests: XCTestCase { | ||
struct Day11Tests { | ||
let day = Day11() | ||
|
||
func testPart1() { | ||
XCTAssertEqual(day.part1Solution(for: "ne,ne,ne"), "3") | ||
XCTAssertEqual(day.part1Solution(for: "ne,ne,sw,sw"), "0") | ||
XCTAssertEqual(day.part1Solution(for: "ne,ne,s,s"), "2") | ||
XCTAssertEqual(day.part1Solution(for: "se,sw,se,sw,sw"), "3") | ||
@Test func part1() { | ||
#expect(day.part1Solution(for: "ne,ne,ne") == "3") | ||
#expect(day.part1Solution(for: "ne,ne,sw,sw") == "0") | ||
#expect(day.part1Solution(for: "ne,ne,s,s") == "2") | ||
#expect(day.part1Solution(for: "se,sw,se,sw,sw") == "3") | ||
|
||
|
||
XCTAssertEqual(day.part1Solution(), "747") | ||
#expect(day.part1Solution() == "747") | ||
} | ||
|
||
func testPart2() { | ||
XCTAssertEqual(day.part2Solution(for: "ne,ne,ne"), "3") | ||
XCTAssertEqual(day.part2Solution(for: "ne,ne,sw,sw"), "2") | ||
XCTAssertEqual(day.part2Solution(for: "ne,ne,s,s"), "2") | ||
XCTAssertEqual(day.part2Solution(for: "se,sw,se,sw,sw"), "3") | ||
@Test func part2() { | ||
#expect(day.part2Solution(for: "ne,ne,ne") == "3") | ||
#expect(day.part2Solution(for: "ne,ne,sw,sw") == "2") | ||
#expect(day.part2Solution(for: "ne,ne,s,s") == "2") | ||
#expect(day.part2Solution(for: "se,sw,se,sw,sw") == "3") | ||
|
||
XCTAssertEqual(day.part2Solution(), "1544") | ||
#expect(day.part2Solution() == "1544") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import XCTest | ||
import Testing | ||
@testable import AdventOfCode2017 | ||
|
||
final class Day14Tests: XCTestCase { | ||
struct Day14Tests { | ||
let day = Day14() | ||
|
||
func testPart1() { | ||
@Test func part1() { | ||
// Slow | ||
// XCTAssertEqual(day.part1Solution(for: "flqrgnkx"), "8108") | ||
// XCTAssertEqual(day.part1Solution(), "8250") | ||
// #expect(day.part1Solution(for: "flqrgnkx") == "8108") | ||
// #expect(day.part1Solution() == "8250") | ||
} | ||
|
||
func testPart2() { | ||
@Test func part2() { | ||
// Slow | ||
// XCTAssertEqual(day.part2Solution(for: "flqrgnkx"), "1242") | ||
// XCTAssertEqual(day.part2Solution(), "1113") | ||
// #expect(day.part2Solution(for: "flqrgnkx") == "1242") | ||
// #expect(day.part2Solution() == "1113") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import XCTest | ||
import Testing | ||
@testable import AdventOfCode2017 | ||
|
||
final class Day15Tests: XCTestCase { | ||
struct Day15Tests { | ||
let day = Day15() | ||
|
||
func testPart1() { | ||
@Test func part1() { | ||
// Slow | ||
// XCTAssertEqual(day.part1Solution(for: "65,8921"), "588") | ||
// XCTAssertEqual(day.part1Solution(), "573") | ||
// #expect(day.part1Solution(for: "65,8921") == "588") | ||
// #expect(day.part1Solution() == "573") | ||
} | ||
|
||
func testPart2() { | ||
@Test func part2() { | ||
// Slow | ||
// XCTAssertEqual(day.part2Solution(for: "65,8921"), "309") | ||
// XCTAssertEqual(day.part2Solution(), "294") | ||
// #expect(day.part2Solution(for: "65,8921") == "309") | ||
// #expect(day.part2Solution() == "294") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
import XCTest | ||
import Testing | ||
@testable import AdventOfCode2017 | ||
|
||
final class Day16Tests: XCTestCase { | ||
struct Day16Tests { | ||
let exampleDay = Day16(programSize: 5) | ||
let day = Day16() | ||
|
||
func testPart1() { | ||
XCTAssertEqual(exampleDay.part1Solution(for: "s1,x3/4,pe/b"), "baedc") | ||
@Test func part1() { | ||
#expect(exampleDay.part1Solution(for: "s1,x3/4,pe/b") == "baedc") | ||
|
||
XCTAssertEqual(day.part1Solution(), "glnacbhedpfjkiom") | ||
#expect(day.part1Solution() == "glnacbhedpfjkiom") | ||
} | ||
|
||
func testPart2() { | ||
XCTAssertEqual(exampleDay.part2Solution(for: "s1,x3/4,pe/b"), "abcde") | ||
@Test func part2() { | ||
#expect(exampleDay.part2Solution(for: "s1,x3/4,pe/b") == "abcde") | ||
|
||
XCTAssertEqual(day.part2Solution(), "fmpanloehgkdcbji") | ||
#expect(day.part2Solution() == "fmpanloehgkdcbji") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import XCTest | ||
import Testing | ||
@testable import AdventOfCode2017 | ||
|
||
final class Day17Tests: XCTestCase { | ||
struct Day17Tests { | ||
let day = Day17() | ||
|
||
func testPart1() { | ||
XCTAssertEqual(day.part1Solution(for: "3"), "638") | ||
@Test func part1() { | ||
#expect(day.part1Solution(for: "3") == "638") | ||
|
||
XCTAssertEqual(day.part1Solution(), "725") | ||
#expect(day.part1Solution() == "725") | ||
} | ||
|
||
func testPart2() { | ||
@Test func part2() { | ||
// Slow | ||
// XCTAssertEqual(day.part2Solution(), "27361412") | ||
// #expect(day.part2Solution() == "27361412") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import XCTest | ||
import Testing | ||
@testable import AdventOfCode2017 | ||
|
||
final class Day1Tests: XCTestCase { | ||
struct Day1Tests { | ||
let day = Day1() | ||
|
||
func testPart1() { | ||
XCTAssertEqual(day.part1Solution(for: "1122"), "3") | ||
XCTAssertEqual(day.part1Solution(for: "1111"), "4") | ||
XCTAssertEqual(day.part1Solution(for: "1234"), "0") | ||
XCTAssertEqual(day.part1Solution(for: "91212129"), "9") | ||
@Test func part1() { | ||
#expect(day.part1Solution(for: "1122") == "3") | ||
#expect(day.part1Solution(for: "1111") == "4") | ||
#expect(day.part1Solution(for: "1234") == "0") | ||
#expect(day.part1Solution(for: "91212129") == "9") | ||
|
||
XCTAssertEqual(day.part1Solution(), "1343") | ||
#expect(day.part1Solution() == "1343") | ||
} | ||
|
||
func testPart2() { | ||
XCTAssertEqual(day.part2Solution(for: "1212"), "6") | ||
XCTAssertEqual(day.part2Solution(for: "1221"), "0") | ||
XCTAssertEqual(day.part2Solution(for: "123425"), "4") | ||
XCTAssertEqual(day.part2Solution(for: "123123"), "12") | ||
XCTAssertEqual(day.part2Solution(for: "12131415"), "4") | ||
@Test func part2() { | ||
#expect(day.part2Solution(for: "1212") == "6") | ||
#expect(day.part2Solution(for: "1221") == "0") | ||
#expect(day.part2Solution(for: "123425") == "4") | ||
#expect(day.part2Solution(for: "123123") == "12") | ||
#expect(day.part2Solution(for: "12131415") == "4") | ||
|
||
XCTAssertEqual(day.part2Solution(), "1274") | ||
#expect(day.part2Solution() == "1274") | ||
} | ||
} |
Oops, something went wrong.