🗑️ 移除test_glaz
✨ 新增测试`test_lsp_any`
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
namespace lsp::test
|
||||
{
|
||||
// 简单的测试结果结构
|
||||
struct TestResult
|
||||
{
|
||||
std::string testName;
|
||||
bool passed;
|
||||
std::string message;
|
||||
};
|
||||
|
||||
// 测试运行器类
|
||||
class TestRunner
|
||||
{
|
||||
public:
|
||||
using TestFunction = std::function<TestResult()>;
|
||||
|
||||
void addTest(const std::string& name, TestFunction test);
|
||||
void runAllTests();
|
||||
int getFailedCount() const;
|
||||
int getTotalCount() const;
|
||||
|
||||
private:
|
||||
struct TestCase
|
||||
{
|
||||
std::string name;
|
||||
TestFunction function;
|
||||
};
|
||||
|
||||
std::vector<TestCase> tests;
|
||||
std::vector<TestResult> results;
|
||||
|
||||
void printResult(const TestResult& result);
|
||||
void printSummary();
|
||||
};
|
||||
|
||||
// 断言辅助函数
|
||||
void assertTrue(bool condition, const std::string& message);
|
||||
void assertFalse(bool condition, const std::string& message);
|
||||
void assertEqual(int expected, int actual, const std::string& message);
|
||||
void assertEqual(unsigned int expected, unsigned int actual, const std::string& message);
|
||||
void assertEqual(double expected, double actual, const std::string& message);
|
||||
void assertEqual(bool expected, bool actual, const std::string& message);
|
||||
void assertEqual(const std::string& expected, const std::string& actual, const std::string& message);
|
||||
void assertEqual(size_t expected, size_t actual, const std::string& message);
|
||||
}
|
||||
Reference in New Issue
Block a user