Files
msime-windows/server/tests/includes/test_framework.h
T
Evan 42238a2af6 style: 用 .clang-format 重排 server / windows / ui / log
一次性重排,无任何行为改动。四个目录各自的 .clang-format 放在仓库里已久,但全组织只有
MSIME-Linux 在 CI 里执行 clang-format 检查,这边 149 个文件里有 149 个不符合自己声明的风格。

已逐文件核对语义等价:去掉空白、注释与相邻字符串字面量拆分之后,全部 149 个文件与重排前逐字节
相同。差异只有三类——缩进与换行、clang-format 补的 } // namespace 结尾注释、以及长字符串被拆成
相邻字面量(C++ 保证自动拼接)。

这个提交会写进 .git-blame-ignore-revs。
2026-09-06 12:13:47 +09:00

48 lines
2.6 KiB
C++

#pragma once
#include <functional>
#include <stdexcept>
#include <string>
#include <vector>
namespace test
{
struct TestCase
{
std::string name;
std::function<void()> fn;
};
std::vector<TestCase> &registry();
struct Registrar
{
Registrar(const char *name, std::function<void()> fn);
};
} // namespace test
#define TEST_CASE(name) \
static void name(); \
static test::Registrar name##_registrar(#name, name); \
static void name()
#define REQUIRE(expr) \
do \
{ \
if (!(expr)) \
{ \
throw std::runtime_error("Requirement failed: " #expr); \
} \
} while (false)
#define REQUIRE_EQ(lhs, rhs) \
do \
{ \
const auto &_lhs = (lhs); \
const auto &_rhs = (rhs); \
if (!(_lhs == _rhs)) \
{ \
throw std::runtime_error("Requirement failed: " #lhs " == " #rhs); \
} \
} while (false)