-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday4-test.cpp
More file actions
128 lines (87 loc) · 2.47 KB
/
day4-test.cpp
File metadata and controls
128 lines (87 loc) · 2.47 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#include <gtest/gtest.h>
#include <fstream>
#include <iostream>
#include <string>
#include "main.h"
using namespace std;
class Day4Test : public ::testing::Test{};
TEST_F(Day4Test, PuzzleInputPart1 ) {
ifstream is( "day4.input" );
ostringstream os;
mainfunc( is, os, Part::PART1 );
EXPECT_EQ( "455\n", os.str() );
}
TEST_F(Day4Test, Description1_1 ) {
istringstream is( "aa bb cc dd ee\n" );
ostringstream os;
mainfunc( is, os, Part::PART1 );
EXPECT_EQ( "1\n", os.str() );
}
TEST_F(Day4Test, Description1_2 ) {
istringstream is( "aa bb cc dd aa\n" );
ostringstream os;
mainfunc( is, os, Part::PART1 );
EXPECT_EQ( "0\n", os.str() );
}
TEST_F(Day4Test, Description1_3 ) {
istringstream is( "aa bb cc dd aaa\n" );
ostringstream os;
mainfunc( is, os, Part::PART1 );
EXPECT_EQ( "1\n", os.str() );
}
TEST_F(Day4Test, Description1_4 ) {
stringstream is;
is << "aa bb cc dd ee\n";
is << "aa bb cc dd aa\n";
is << "aa bb cc dd aaa\n";
ostringstream os;
mainfunc( is, os, Part::PART1 );
EXPECT_EQ( "2\n", os.str() );
}
TEST_F(Day4Test, PuzzleInputPart2 ) {
ifstream is( "day4.input" );
ostringstream os;
mainfunc( is, os, Part::PART2 );
EXPECT_EQ( "186\n", os.str() );
}
TEST_F(Day4Test, Description2_1 ) {
istringstream is( "abcde fghij\n" );
ostringstream os;
mainfunc( is, os, Part::PART2 );
EXPECT_EQ( "1\n", os.str() );
}
TEST_F(Day4Test, Description2_2 ) {
istringstream is( "abcde xyz ecdab\n" );
ostringstream os;
mainfunc( is, os, Part::PART2 );
EXPECT_EQ( "0\n", os.str() );
}
TEST_F(Day4Test, Description2_3 ) {
istringstream is( "a ab abc abd abf abj\n" );
ostringstream os;
mainfunc( is, os, Part::PART2 );
EXPECT_EQ( "1\n", os.str() );
}
TEST_F(Day4Test, Description2_4 ) {
istringstream is( "iiii oiii ooii oooi oooo\n" );
ostringstream os;
mainfunc( is, os, Part::PART2 );
EXPECT_EQ( "1\n", os.str() );
}
TEST_F(Day4Test, Description2_5 ) {
istringstream is( "oiii ioii iioi iiio\n" );
ostringstream os;
mainfunc( is, os, Part::PART2 );
EXPECT_EQ( "0\n", os.str() );
}
TEST_F(Day4Test, Description2_6 ) {
stringstream is;
is << "abcde fghij\n";
is << "abcde xyz ecdab\n";
is << "a ab abc abd abf abj\n";
is << "iiii oiii ooii oooi oooo\n";
is << "oiii ioii iioi iiio\n";
ostringstream os;
mainfunc( is, os, Part::PART2 );
EXPECT_EQ( "3\n", os.str() );
}