utest: + array,vector printers

This commit is contained in:
Roland Conybeare 2023-09-21 11:20:56 -04:00
commit cc82199a8e
3 changed files with 91 additions and 1 deletions

40
utest/array.test.cpp Normal file
View file

@ -0,0 +1,40 @@
/* @file array.test.cpp */
#include "indentlog/print/array.hpp" /* overload operator<< for std::array */
#include "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 */