aboutsummaryrefslogtreecommitdiff
path: root/test/test_2020.cpp
blob: fd38eab66bdc4bb266ab92adfc6068994e1eacee (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
#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 "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));
}