aboutsummaryrefslogtreecommitdiff
path: root/test/test_2019.cpp
blob: 2876ec937c99d692fb47b0c56d118f04e4abcc1d (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
67
68
69
70
71
72
73
74
75
76
#include "2019/day1/aoc.h"
#include "2019/day2/aoc.h"
#include "2019/day3/aoc.h"
#include "2019/day4/aoc.h"
#include "2019/day5/aoc.h"
#include "2019/day6/aoc.h"
#include "2019/day7/aoc.h"
#include "2019/day8/aoc.h"
#include "2019/day9/aoc.h"
#include "2019/day10/aoc.h"
#include "catch.hpp"
#include <stdio.h>

TEST_CASE("The Tyranny of the Rocket Equation", "[2019]") {
  line_view lv = load_file("../src/2019/day1/input");
  REQUIRE(3471229 == aoc2019::day1(lv));
  REQUIRE(5203967 == aoc2019::day1part2(lv));
  REQUIRE(50346 == aoc2019::day1part2("100756"));
}

TEST_CASE("1202 Program Alarm", "[2019]") {
  line_view lv = load_file("../src/2019/day2/input");
  auto p = aoc2019::day2(lv);
  REQUIRE(11590668 == p.first);
  REQUIRE(2254 == p.second);
}

TEST_CASE("Crossed Wires", "[2019]") {
  line_view lv = load_file("../src/2019/day3/input");
  auto p = aoc2019::day3(lv);
  REQUIRE(19242 == p.first);
  REQUIRE(266 == p.second);
}

TEST_CASE("Secure Container", "[2019]") {
  auto p = aoc2019::day4("264793", "803935");
  REQUIRE(966 == p.first);
  REQUIRE(628 == p.second);
}

TEST_CASE("Sunny with a Chance of Asteroids", "[2019]") {
  line_view lv = load_file("../src/2019/day5/input");
  auto p = aoc2019::day5(lv);
  REQUIRE(6761139 == p.first);
  REQUIRE(9217546 == p.second);
}

TEST_CASE("Universal Orbit Map", "[2019]") {
  line_view lv = load_file("../src/2019/day6/input");
  auto p = aoc2019::day6(lv);
  REQUIRE(312697 == p.first);
  REQUIRE(466 == p.second);
}

TEST_CASE("Amplification Circuit", "[2019]") {
  line_view lv = load_file("../src/2019/day7/input");
  auto p = aoc2019::day7(lv);
  REQUIRE(272368 == p.first);
  REQUIRE(19741286 == p.second);
  // auto p = aoc2019::day7("3,26,1001,26,-4,26,3,27,1002,27,2,27,1,27,26,27,4,27,1001,28,-1,28,1005,28,6,99,0,0,5");
  // auto p = aoc2019::day7("3,52,1001,52,-5,52,3,53,1,52,56,54,1007,54,5,55,1005,55,26,1001,54,-5,54,1105,1,12,1,53,54,53,1008,54,0,55,1001,55,1,55,2,53,55,53,4,53,1001,56,-1,56,1005,56,6,99,0,0,0,0,10");
  // REQUIRE(139629729 == p.second);
}

TEST_CASE("Space Image Format", "[2019]") {
  line_view lv = load_file("../src/2019/day8/input");
  auto p = aoc2019::day8(lv);
  REQUIRE(2048 == p.first);
}

TEST_CASE("Monitoring Station", "[2019]") {
  line_view lv = load_file("../src/2019/day10/input");
  auto p = aoc2019::day10(lv);
  REQUIRE(334 == p.first);
  REQUIRE(1119 == p.second);
}