make output stream a Main parameter
This commit is contained in:
@@ -78,9 +78,9 @@ TEST_CASE("part 2") {
|
||||
|
||||
}
|
||||
|
||||
auto Main(std::istream & in) -> void
|
||||
auto Main(std::istream & in, std::ostream & out) -> void
|
||||
{
|
||||
auto const entries {Parse(in)};
|
||||
std::cout << "Part 1: " << Part1(entries) << std::endl;
|
||||
std::cout << "Part 2: " << Part2(entries) << std::endl;
|
||||
out << "Part 1: " << Part1(entries) << std::endl;
|
||||
out << "Part 2: " << Part2(entries) << std::endl;
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ TEST_CASE("part 2") {
|
||||
|
||||
}
|
||||
|
||||
auto Main(std::istream & in) -> void
|
||||
auto Main(std::istream & in, std::ostream & out) -> void
|
||||
{
|
||||
std::uint64_t part1{}, part2{};
|
||||
|
||||
@@ -66,6 +66,6 @@ auto Main(std::istream & in) -> void
|
||||
if (Part1(entry)) part1++;
|
||||
if (Part2(entry)) part2++;
|
||||
}
|
||||
std::cout << "Part 1: " << part1 << std::endl;
|
||||
std::cout << "Part 2: " << part2 << std::endl;
|
||||
out << "Part 1: " << part1 << std::endl;
|
||||
out << "Part 2: " << part2 << std::endl;
|
||||
}
|
||||
|
@@ -76,9 +76,9 @@ TEST_CASE("part 2") {
|
||||
|
||||
}
|
||||
|
||||
auto Main(std::istream & in) -> void
|
||||
auto Main(std::istream & in, std::ostream & out) -> void
|
||||
{
|
||||
auto const grid {Grid::Parse(in)};
|
||||
std::cout << "Part 1: " << Part1(grid) << std::endl;
|
||||
std::cout << "Part 2: " << Part2(grid) << std::endl;
|
||||
out << "Part 1: " << Part1(grid) << std::endl;
|
||||
out << "Part 2: " << Part2(grid) << std::endl;
|
||||
}
|
||||
|
@@ -75,9 +75,9 @@ TEST_CASE("part 2") {
|
||||
|
||||
}
|
||||
|
||||
auto Main(std::istream & in) -> void
|
||||
auto Main(std::istream & in, std::ostream & out) -> void
|
||||
{
|
||||
auto const adapters {Parse(in)};
|
||||
std::cout << "Part 1: " << Part1(adapters) << std::endl;
|
||||
std::cout << "Part 2: " << Part2(adapters) << std::endl;
|
||||
out << "Part 1: " << Part1(adapters) << std::endl;
|
||||
out << "Part 2: " << Part2(adapters) << std::endl;
|
||||
}
|
||||
|
@@ -184,9 +184,9 @@ TEST_SUITE("documented examples") {
|
||||
}
|
||||
}
|
||||
|
||||
auto Main(std::istream & in) -> void
|
||||
auto Main(std::istream & in, std::ostream & out) -> void
|
||||
{
|
||||
auto input {Parse(in)};
|
||||
std::cout << "Part 1: " << Part1(input) << std::endl;
|
||||
std::cout << "Part 2: " << Part2(input) << std::endl;
|
||||
out << "Part 1: " << Part1(input) << std::endl;
|
||||
out << "Part 2: " << Part2(input) << std::endl;
|
||||
}
|
||||
|
@@ -140,7 +140,7 @@ TEST_CASE("errors") {
|
||||
|
||||
}
|
||||
|
||||
auto Main(std::istream & in) -> void
|
||||
auto Main(std::istream & in, std::ostream & out) -> void
|
||||
{
|
||||
std::int64_t part1 = 0;
|
||||
std::int64_t part2 = 0;
|
||||
@@ -151,6 +151,6 @@ auto Main(std::istream & in) -> void
|
||||
part2 += Part2(line);
|
||||
}
|
||||
|
||||
std::cout << "Part 1: " << part1 << std::endl;
|
||||
std::cout << "Part 2: " << part2 << std::endl;
|
||||
out << "Part 1: " << part1 << std::endl;
|
||||
out << "Part 2: " << part2 << std::endl;
|
||||
}
|
||||
|
@@ -178,9 +178,9 @@ TEST_CASE("part 2") {
|
||||
|
||||
}
|
||||
|
||||
auto Main(std::istream & in) -> void
|
||||
auto Main(std::istream & in, std::ostream & out) -> void
|
||||
{
|
||||
auto const input {Parse(in)};
|
||||
std::cout << "Part 1: " << Part1(input) << std::endl;
|
||||
std::cout << "Part 2: " << Part2(input) << std::endl;
|
||||
out << "Part 1: " << Part1(input) << std::endl;
|
||||
out << "Part 2: " << Part2(input) << std::endl;
|
||||
}
|
||||
|
Reference in New Issue
Block a user