AoC code coverage
Current view: top level - puzzles/2019 - Day05.cpp (source / functions) Coverage Total Hit
Test: master Lines: 100.0 % 17 17
Test Date: 2025-07-28 10:53:57 Functions: 100.0 % 4 4

            Line data    Source code
       1              : #include "Intcode.h"
       2              : #include "IntegerCast.h"
       3              : #include "Parsing.h"
       4              : #include "PuzzleImpl.h"
       5              : 
       6              : namespace {} // namespace
       7              : 
       8            1 : template <> size_t part1<2019, 5>(std::string_view const input) {
       9            1 :   Computer c(input);
      10            1 :   std::vector<int64_t> outputs;
      11           10 :   c.registerOutput([&](int64_t v) { outputs.push_back(v); });
      12            1 :   c.queueInput(1);
      13            1 :   ASSERT(c.run() == Computer::HALTED);
      14           10 :   for (size_t i = 0; i < outputs.size() - 1; ++i)
      15            9 :     ASSERT(outputs[i] == 0);
      16            1 :   return outputs.back();
      17            1 : }
      18              : 
      19            1 : template <> size_t part2<2019, 5>(std::string_view const input) {
      20            1 :   Computer c(input);
      21            1 :   int64_t lastOutput = 0;
      22            1 :   c.registerOutput([&](int64_t v) { lastOutput = v; });
      23            1 :   c.queueInput(5);
      24              :   ASSERT(c.run() == Computer::HALTED);
      25            1 :   return lastOutput;
      26            1 : }
        

Generated by: LCOV version 2.0-1