AoC code coverage
Current view: top level - aoclib - Grid2d.cpp (source / functions) Coverage Total Hit
Test: master Lines: 0.0 % 29 0
Test Date: 2025-07-28 10:53:57 Functions: 0.0 % 2 0

            Line data    Source code
       1              : #include "Grid2d.h"
       2              : 
       3              : #include <iterator>
       4              : 
       5            0 : std::ostream &operator<<(std::ostream &oss, Grid2dSpan<char> const &span) {
       6            0 :   if (span.ySize() == 0)
       7            0 :     return oss;
       8              : 
       9            0 :   Grid2dSpan<char>::IndexType y = span.ySize() - 1;
      10            0 :   for (Grid2dSpan<char>::IndexType x = 0; x < span.xSize(); ++x)
      11            0 :     oss << span[x, y];
      12              : 
      13            0 :   --y;
      14              : 
      15            0 :   for (; y >= 0; --y) {
      16            0 :     oss << '\n';
      17            0 :     for (Grid2d<char>::IndexType x = 0; x < span.xSize(); ++x)
      18            0 :       oss << span[x, y];
      19            0 :   }
      20              : 
      21            0 :   return oss;
      22            0 : }
      23              : 
      24            0 : std::ostream &operator<<(std::ostream &oss, SparseGrid2d<char> const &grid) {
      25            0 :   auto [min, max] = grid.nonDefaultCoordsInterval();
      26              : 
      27            0 :   if (max < min)
      28            0 :     return oss;
      29              : 
      30            0 :   SparseGrid2d<char>::Coord pos{min[0], max[1]};
      31              : 
      32            0 :   for (; pos[0] <= max[0]; ++pos[0])
      33            0 :     oss << grid[pos];
      34              : 
      35            0 :   --pos[1];
      36              : 
      37            0 :   for (; pos[1] >= min[1]; --pos[1]) {
      38            0 :     oss << '\n';
      39            0 :     for (pos[0] = min[0]; pos[0] <= max[0]; ++pos[0])
      40            0 :       oss << grid[pos];
      41            0 :   }
      42            0 :   return oss;
      43            0 : }
        

Generated by: LCOV version 2.0-1