aboutsummaryrefslogtreecommitdiff
path: root/test/test_2020.cpp
blob: ef529a0aed3cb37a7badf7ca58f3af597492ad94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "2020/day1/aoc.h"
#include "2020/day2/aoc.h"
#include "2020/day3/aoc.h"
#include "2020/day4/aoc.h"
#include "2020/day5/aoc.h"
#include "2020/day6/aoc.h"
#include "2020/day7/aoc.h"
#include "2020/day8/aoc.h"
#include "catch.hpp"
#include <stdio.h>

TEST_CASE("Report Repair", "[2020]") {
  line_view lv = load_file("../src/2020/day1/input");
  auto p = aoc2020::day1(lv, 2020);
  REQUIRE(1019904 == p.first);
  REQUIRE(176647680 == p.second);
}

TEST_CASE("Password Philosophy", "[2020]") {
  line_view lv = load_file("../src/2020/day2/input");
  auto p = aoc2020::day2(lv);
  REQUIRE(564 == p.first);
  REQUIRE(325 == p.second);
}

TEST_CASE("Toboggan Trajectory", "[2020]") {
  // line_view lv = load_file("../src/2020/day3/input0");
  line_view lv = load_file("../src/2020/day3/input");
  auto p = aoc2020::day3(lv);
  REQUIRE(242 == p.first);
  REQUIRE(2265549792 == p.second);
}

TEST_CASE("Passport Processing", "[2020]") {
  line_view lv = load_file("../src/2020/day4/input");
  auto p = aoc2020::day4(lv);
  REQUIRE(256 == p.first);
  REQUIRE(198 == p.second);
}

TEST_CASE("Binary Boarding", "[2020]") {
  // line_view lv("BFFFBBFRRR\nFFFBBBFRRR\nBBFFBBFRLL\n");
  line_view lv = load_file("../src/2020/day5/input");
  REQUIRE(842 == aoc2020::day5(lv));
}

TEST_CASE("Custom Customs", "[2020]") {
  line_view lv = load_file("../src/2020/day6/input");
  auto p = aoc2020::day6(lv);
  REQUIRE(7120 == p.first);
  REQUIRE(3570 == p.second);
}

TEST_CASE("Handy Haversacks", "[2020]") {
  line_view lv = load_file("../src/2020/day7/input");
  auto p = aoc2020::day7(lv, "shiny gold");
  REQUIRE(126 == p.first);
  REQUIRE(220149 == p.second);
}

TEST_CASE("Handheld Halting", "[2020]") {
  line_view lv = load_file("../src/2020/day8/input");
  auto p = aoc2020::day8(lv);
  REQUIRE(1814 == p.first);
  REQUIRE(1056 == p.second);
}