aboutsummaryrefslogtreecommitdiff
path: root/test/test_2021.cpp
blob: 7a57e5f28371042eb0accde537d78574fb185b1b (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
#include "2021/day1/aoc.h"
#include "2021/day2/aoc.h"
#include "2021/day3/aoc.h"
#include "2021/day4/aoc.h"
#include "2021/day5/aoc.h"
#include "catch.hpp"
#include <stdio.h>

TEST_CASE("Sonar Sweep", "[2021]") {
  line_view lv = load_file("../src/2021/day1/input");
  auto p = aoc2021::day1(lv);
  REQUIRE(1616 == p.first);
  REQUIRE(1645 == p.second);
}

TEST_CASE("Dive!", "[2021]") {
  line_view lv = load_file("../src/2021/day2/input");
  auto p = aoc2021::day2(lv);
  REQUIRE(1762050 == p.first);
  REQUIRE(1855892637 == p.second);
}

TEST_CASE("Binary Diagnostic", "[2021]") {
  line_view lv = load_file("../src/2021/day3/input");
  // line_view lv = load_file("../src/2021/day3/input0");
  auto p = aoc2021::day3(lv);
  REQUIRE(3885894 == p.first);
  REQUIRE(4375225 == p.second);
}

TEST_CASE("Giant Squid", "[2021]") {
  line_view lv = load_file("../src/2021/day4/input");
  REQUIRE(0 == aoc2021::day4(lv));
}