-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
62 lines (47 loc) · 1.49 KB
/
main.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
56
57
58
59
60
61
62
#include "../advent.h"
namespace day## {
/// Change this to the current day
static const std::string day = "##";
static const std::string inputFilename = "..\\day" + day + "\\input.txt";
static const std::string testFilename = "..\\day" + day + "\\test.txt";
struct PuzzleInput {
std::vector<std::string> lines;
explicit PuzzleInput(const std::string &filename) {
std::ifstream istream(filename);
std::string line;
while (std::getline(istream, line)) {
// do something
lines.emplace_back(std::move(line));
}
}
};
/// Unit Test
void test() {
PuzzleInput input(testFilename);
assert(true);
}
/// Part One Solution
int partOne() {
PuzzleInput input(inputFilename);
return 0;
}
/// Part Two Solution
int partTwo() {
PuzzleInput input(inputFilename);
return 0;
}
}
int main() {
using namespace day##;
test();
{
std::cout << std::fixed << std::setprecision(3);
auto [seconds, result] = advent::eval<int>(&partOne);
std::cout << "Day " << day << ": Part One = " << result << "\t\t (completed in " << seconds << "s).\n";
}
{
std::cout << std::fixed << std::setprecision(3);
auto [seconds, result] = advent::eval<int>(&partTwo);
std::cout << "Day " << day << ": Part One = " << result << "\t\t (completed in " << seconds << "s).\n";
}
}