From c046d5da01d85e5ec4757c05a42d0337ae49d0cd Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Sun, 15 Sep 2019 13:44:26 +0200 Subject: [PATCH] Restructure header files. This should prevent the tests from being recompiled. --- 2019/CMakeLists.txt | 2 +- 2019/src/day01.cpp | 2 +- 2019/src/{solutions.hpp => days.hpp} | 4 ---- 2019/src/{solutions.cpp => implementations.cpp} | 3 ++- 2019/src/implementations.hpp | 9 +++++++++ 2019/src/runner.cpp | 2 +- 2019/tests/test_solutions.cpp | 2 +- 7 files changed, 15 insertions(+), 9 deletions(-) rename 2019/src/{solutions.hpp => days.hpp} (63%) rename 2019/src/{solutions.cpp => implementations.cpp} (84%) create mode 100644 2019/src/implementations.hpp diff --git a/2019/CMakeLists.txt b/2019/CMakeLists.txt index d8c7ad6..7e17420 100644 --- a/2019/CMakeLists.txt +++ b/2019/CMakeLists.txt @@ -4,7 +4,7 @@ project(aoc2019) find_package(Boost REQUIRED COMPONENTS program_options unit_test_framework filesystem) -add_library(AoCSolutions src/solutions.hpp src/solutions.cpp src/day01.cpp) +add_library(AoCSolutions src/implementations.hpp src/implementations.cpp src/day01.cpp src/days.hpp) target_compile_features(AoCSolutions PUBLIC cxx_std_17) add_executable(runner src/runner.cpp) diff --git a/2019/src/day01.cpp b/2019/src/day01.cpp index 250339f..a51511b 100644 --- a/2019/src/day01.cpp +++ b/2019/src/day01.cpp @@ -2,7 +2,7 @@ #include #include #include -#include "solutions.hpp" +#include "days.hpp" // Currently an implementation of 2018 day 1 void aoc2019::day01_part1(std::istream &input, std::ostream &output) { diff --git a/2019/src/solutions.hpp b/2019/src/days.hpp similarity index 63% rename from 2019/src/solutions.hpp rename to 2019/src/days.hpp index 7ac9747..f511242 100644 --- a/2019/src/solutions.hpp +++ b/2019/src/days.hpp @@ -3,10 +3,6 @@ #include namespace aoc2019 { - typedef void (*solution_t)(std::istream &, std::ostream &); - - solution_t get_implementation(int day, bool part2 = false); - // Declarations of all implemented days. void day01_part1(std::istream &input, std::ostream &output); void day01_part2(std::istream &input, std::ostream &output); diff --git a/2019/src/solutions.cpp b/2019/src/implementations.cpp similarity index 84% rename from 2019/src/solutions.cpp rename to 2019/src/implementations.cpp index bb8fd0d..570aca2 100644 --- a/2019/src/solutions.cpp +++ b/2019/src/implementations.cpp @@ -1,5 +1,6 @@ #include -#include "solutions.hpp" +#include "days.hpp" +#include "implementations.hpp" constexpr const std::array, 25> SOLUTIONS = { {aoc2019::day01_part1, aoc2019::day01_part2} diff --git a/2019/src/implementations.hpp b/2019/src/implementations.hpp new file mode 100644 index 0000000..24e9820 --- /dev/null +++ b/2019/src/implementations.hpp @@ -0,0 +1,9 @@ +#pragma once + +#include + +namespace aoc2019 { + typedef void (*solution_t)(std::istream &, std::ostream &); + + solution_t get_implementation(int day, bool part2 = false); +} diff --git a/2019/src/runner.cpp b/2019/src/runner.cpp index 5beefcb..d47951c 100644 --- a/2019/src/runner.cpp +++ b/2019/src/runner.cpp @@ -1,4 +1,4 @@ -#include "solutions.hpp" +#include "implementations.hpp" #include #include #include diff --git a/2019/tests/test_solutions.cpp b/2019/tests/test_solutions.cpp index 454043a..370412d 100644 --- a/2019/tests/test_solutions.cpp +++ b/2019/tests/test_solutions.cpp @@ -5,7 +5,7 @@ #include #include #include -#include "solutions.hpp" +#include "implementations.hpp" std::vector get_samples() { std::vector samples;