core: clang-format pass against the landed root .clang-format
Pure formatting, no behaviour change. PKG landed .clang-format (Google base, 4-space indent, 100 cols); this brings util/ and the test harness into conformance so `clang-format --dry-run -Werror` is clean. Build and all six test binaries unchanged and green. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HPPSGhiArbvQgwC2DNiURS
This commit is contained in:
@@ -52,11 +52,11 @@ struct Registrar {
|
||||
Registrar(const char *name, void (*fn)()) { registry().push_back({name, fn}); }
|
||||
};
|
||||
|
||||
inline void report(const char *file, int line, std::string_view expr,
|
||||
std::string_view detail, bool fatal) {
|
||||
inline void report(const char *file, int line, std::string_view expr, std::string_view detail,
|
||||
bool fatal) {
|
||||
stats().failures++;
|
||||
std::fprintf(stderr, " FAIL %s:%d %.*s", file, line,
|
||||
static_cast<int>(expr.size()), expr.data());
|
||||
std::fprintf(stderr, " FAIL %s:%d %.*s", file, line, static_cast<int>(expr.size()),
|
||||
expr.data());
|
||||
if (!detail.empty())
|
||||
std::fprintf(stderr, " [%.*s]", static_cast<int>(detail.size()), detail.data());
|
||||
std::fprintf(stderr, "\n");
|
||||
@@ -110,46 +110,45 @@ inline int run_all() {
|
||||
|
||||
} // namespace vt
|
||||
|
||||
#define VT_TEST(NAME) \
|
||||
static void NAME##_impl(); \
|
||||
static ::vt::Registrar NAME##_reg(#NAME, &NAME##_impl); \
|
||||
#define VT_TEST(NAME) \
|
||||
static void NAME##_impl(); \
|
||||
static ::vt::Registrar NAME##_reg(#NAME, &NAME##_impl); \
|
||||
static void NAME##_impl()
|
||||
|
||||
#define VT_CHECK(COND) \
|
||||
do { \
|
||||
::vt::stats().checks++; \
|
||||
if (!(COND)) \
|
||||
::vt::report(__FILE__, __LINE__, #COND, {}, /*fatal=*/false); \
|
||||
#define VT_CHECK(COND) \
|
||||
do { \
|
||||
::vt::stats().checks++; \
|
||||
if (!(COND)) \
|
||||
::vt::report(__FILE__, __LINE__, #COND, {}, /*fatal=*/false); \
|
||||
} while (0)
|
||||
|
||||
#define VT_REQUIRE(COND) \
|
||||
do { \
|
||||
::vt::stats().checks++; \
|
||||
if (!(COND)) \
|
||||
::vt::report(__FILE__, __LINE__, #COND, {}, /*fatal=*/true); \
|
||||
#define VT_REQUIRE(COND) \
|
||||
do { \
|
||||
::vt::stats().checks++; \
|
||||
if (!(COND)) \
|
||||
::vt::report(__FILE__, __LINE__, #COND, {}, /*fatal=*/true); \
|
||||
} while (0)
|
||||
|
||||
#define VT_CHECK_EQ(A, B) \
|
||||
#define VT_CHECK_EQ(A, B) \
|
||||
do { \
|
||||
::vt::stats().checks++; \
|
||||
auto &&_a = (A); \
|
||||
auto &&_b = (B); \
|
||||
if (!(_a == _b)) \
|
||||
::vt::report(__FILE__, __LINE__, #A " == " #B, \
|
||||
::vt::show(_a) + " vs " + ::vt::show(_b), false); \
|
||||
::vt::stats().checks++; \
|
||||
auto &&_a = (A); \
|
||||
auto &&_b = (B); \
|
||||
if (!(_a == _b)) \
|
||||
::vt::report(__FILE__, __LINE__, #A " == " #B, \
|
||||
::vt::show(_a) + " vs " + ::vt::show(_b), false); \
|
||||
} while (0)
|
||||
|
||||
#define VT_CHECK_NE(A, B) \
|
||||
#define VT_CHECK_NE(A, B) \
|
||||
do { \
|
||||
::vt::stats().checks++; \
|
||||
auto &&_a = (A); \
|
||||
auto &&_b = (B); \
|
||||
if (!(_a != _b)) \
|
||||
::vt::report(__FILE__, __LINE__, #A " != " #B, \
|
||||
::vt::show(_a) + " vs " + ::vt::show(_b), false); \
|
||||
::vt::stats().checks++; \
|
||||
auto &&_a = (A); \
|
||||
auto &&_b = (B); \
|
||||
if (!(_a != _b)) \
|
||||
::vt::report(__FILE__, __LINE__, #A " != " #B, \
|
||||
::vt::show(_a) + " vs " + ::vt::show(_b), false); \
|
||||
} while (0)
|
||||
|
||||
#define VT_FAIL(MSG) \
|
||||
::vt::report(__FILE__, __LINE__, "VT_FAIL", (MSG), /*fatal=*/false)
|
||||
#define VT_FAIL(MSG) ::vt::report(__FILE__, __LINE__, "VT_FAIL", (MSG), /*fatal=*/false)
|
||||
|
||||
#endif // VDM_TESTS_VTEST_HPP
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// vtest_main.cpp — shared entry point for every CORE test binary.
|
||||
#include "vtest.hpp"
|
||||
|
||||
int main() { return ::vt::run_all(); }
|
||||
int main() {
|
||||
return ::vt::run_all();
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ VT_TEST(log_forwards_to_sink_with_format) {
|
||||
VT_TEST(log_level_filter_skips_below_min) {
|
||||
SinkGuard g;
|
||||
auto count = std::make_shared<int>(0);
|
||||
vdm::set_log_sink(std::make_shared<CallbackSink>(
|
||||
[count](const LogRecord &) { ++*count; }, LogLevel::warn));
|
||||
vdm::set_log_sink(
|
||||
std::make_shared<CallbackSink>([count](const LogRecord &) { ++*count; }, LogLevel::warn));
|
||||
|
||||
VDM_LOG_DEBUG("x", "no");
|
||||
VDM_LOG_INFO("x", "no");
|
||||
|
||||
Reference in New Issue
Block a user