testregistry.cpp
来自「计算机软件的测试驱动程序cppunit精简版。」· C++ 代码 · 共 40 行
CPP
40 行
#include "Test.h"
#include "TestResult.h"
#include "TestRegistry.h"
void TestRegistry::addTest (Test *test)
{
instance ().add (test);
}
void TestRegistry::runAllTests (TestResult& result)
{
instance ().run (result);
}
TestRegistry& TestRegistry::instance () {
static TestRegistry registry;
return registry;
}
void TestRegistry::add (Test *test) {
tests.push_back (test);
}
void TestRegistry::run (TestResult& result) {
result.startTests ();
for (std::vector<Test *>::iterator it = tests.begin (); it != tests.end (); ++it)
(*it)->run (result);
result.endTests ();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?