-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday10-test.cpp
52 lines (37 loc) · 1.08 KB
/
day10-test.cpp
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
#include <gtest/gtest.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include "day10.h"
#include "main.h"
using namespace std;
class Day10Test : public ::testing::Test{};
TEST( Day10Test, Part1and2_1 ) {
std::string input(
"value 5 goes to bot 2\n"
"bot 2 gives low to bot 1 and high to bot 0\n"
"value 3 goes to bot 1\n"
"bot 1 gives low to output 1 and high to bot 0\n"
"bot 0 gives low to output 2 and high to output 0\n"
"value 2 goes to bot 2\n"
);
std::istringstream is( input );
unsigned valuesBot;
unsigned product012;
SimulateBots( is, 2U, 5U, valuesBot, product012 );
EXPECT_EQ( 2, valuesBot );
EXPECT_EQ( 30, product012 );
}
TEST(Day10Test, PuzzleInputPart1 ) {
ifstream is( "day10.input" );
ostringstream os;
mainfunc( is, os, Part::PART1 );
EXPECT_EQ( "161\n", os.str() );
}
TEST(Day10Test, PuzzleInputPart2 ) {
ifstream is( "day10.input" );
ostringstream os;
mainfunc( is, os, Part::PART2 );
EXPECT_EQ( "133163\n", os.str() );
}