xo-umbrella2/xo-indentlog/utest/array.test.cpp
Roland Conybeare 966c3903e1 git subrepo clone git@github.com:Rconybea/xo-indentlog.git xo-indentlog
subrepo:
  subdir:   "xo-indentlog"
  merged:   "0834c6ad"
upstream:
  origin:   "git@github.com:Rconybea/xo-indentlog.git"
  branch:   "main"
  commit:   "0834c6ad"
git-subrepo:
  version:  "0.4.9"
  origin:   "???"
  commit:   "???"
2026-06-06 21:30:17 -04:00

40 lines
850 B
C++

/* @file array.test.cpp */
#include "xo/indentlog/print/array.hpp" /* overload operator<< for std::array */
#include "xo/indentlog/print/tag.hpp"
#include <catch2/catch.hpp>
#include <sstream>
using namespace xo;
namespace ut {
TEST_CASE("array", "[array]") {
tag_config::tag_color = color_spec_type::none();
{
std::array<int, 0> x = {};
std::stringstream ss;
ss << x;
REQUIRE(ss.str() == "[]");
}
{
std::array<int, 1> x = {1};
std::stringstream ss;
ss << x;
REQUIRE(ss.str() == "[1]");
}
{
std::array<int, 2> x = {1, 2};
std::stringstream ss;
ss << x;
REQUIRE(ss.str() == "[1 2]");
}
}
} /*namespace ut*/
/* end array.test.cpp */