From a79696c9470723a439aff3cf59fc3f6e4132e571 Mon Sep 17 00:00:00 2001 From: Eric Mertens Date: Tue, 15 Nov 2022 18:20:41 -0800 Subject: [PATCH] Update 09.cpp --- 2019/09.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/2019/09.cpp b/2019/09.cpp index fa17471..c25f2c7 100644 --- a/2019/09.cpp +++ b/2019/09.cpp @@ -1,6 +1,8 @@ #include #include +#include + #include #include using namespace intcode; @@ -17,6 +19,16 @@ auto Compute(Machine machine, ValueType d) -> ValueType { } // namespace +TEST_SUITE("documented examples") { + TEST_CASE("part 1") { + std::vector pgm {109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99}; + std::vector output; + Machine machine {pgm}; + Run(machine, []() -> ValueType{ REQUIRE(false); return 0; }, [&](ValueType o){ output.push_back(o);}); + REQUIRE(pgm == output); + } +} + auto main(int argc, char** argv) -> int { auto machine = Machine{ParseStream(aocpp::Startup(argc, argv))}; std::cout << "Part 1: " << Compute(machine, 1) << std::endl;