我正在尝试在main函数中运行测试,但是显示错误“您不能使main()函数超载”。
#define CATCH_CONFIG_RUNNER // -- main() создавать нужно --
#include "catch.hpp"
int main(int argc, char* argv[])
{
setlocale(LC_ALL, "Russian");
int result = Catch::Session().run(argc, argv);
system("pause");
return result;
}
答案 0 :(得分:0)
您应该以其他方式使用 Catch 。像这样的东西对我有用:
#include <iostream> // some standard includes, whatever you need
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
TEST_CASE("My first test") {
// --- test code here ---
}
TEST_CASE("My second test") {
// --- test code here ---
}
尝试使用框架的tutorial了解更多=)