-
Notifications
You must be signed in to change notification settings - Fork 0
/
day25-test.cpp
55 lines (42 loc) · 1.09 KB
/
day25-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
53
54
55
#include <gtest/gtest.h>
#include <fstream>
#include <iostream>
#include <string>
#include <sstream>
#include "main.h"
using namespace std;
class Day25Test : public ::testing::Test{};
TEST( Day25Test, PuzzleInputPart1 ) {
ifstream is( "day25.input" );
ostringstream os;
mainfunc( is, os, Part::PART1 );
EXPECT_EQ( "5593\n", os.str() );
}
TEST( Day25Test, Description1_1 ) {
const char* input =
R"(Begin in state A.
Perform a diagnostic checksum after 6 steps.
In state A:
If the current value is 0:
- Write the value 1.
- Move one slot to the right.
- Continue with state B.
If the current value is 1:
- Write the value 0.
- Move one slot to the left.
- Continue with state B.
In state B:
If the current value is 0:
- Write the value 1.
- Move one slot to the left.
- Continue with state A.
If the current value is 1:
- Write the value 1.
- Move one slot to the right.
- Continue with state A.
)";
istringstream is( input );
ostringstream os;
mainfunc( is, os, Part::PART1 );
EXPECT_EQ( "3\n", os.str() );
}