xo-umbrella2/xo-alloc2/utest/TestUtil.hpp
Roland Conybeare 550b33323c xo-alloc2: + utest harness for catch2
accept additional commandline arguments
2026-05-19 08:27:10 -04:00

44 lines
921 B
C++

/** @file TestUtil.hpp
*
* @author Roland Conybeare, May 2026
**/
#pragma once
#include <xo/indentlog/scope.hpp>
namespace xo {
/** unit-test configuration here
*
* TODO: promote to its own library, along with UtestListener
**/
struct UtestConfig {
bool debug_flag() const { return debug_flag_; }
/** announce each test using catch2's listener api **/
bool announce_flag_ = false;
/** enable debug output for all (!) tests **/
bool debug_flag_ = false;
static UtestConfig * instance();
};
/** RAII logging for catch unit tests
*
* Use:
* TEST_CASE(name, tags, ..)
* {
* scope log = Utest::ut_scope();
*
* ...
* log && log(xtag("foo", ...));
* }
**/
struct Utest {
static scope ut_scope();
};
} /*namespace xo*/
/* end TestUtil.hpp */