我正在尝试在 Visual Studio 2010 中的 C++ 解决方案中设置一个 boost 单元测试框架。在下面,我为您提供我用于单元测试的代码(好吧,我在尝试理解时使用的代码如何让它发挥作用)。
#define MAP_LOADER_TEST maploadertest
#include <boost/test/unit_test.hpp>
using namespace boost::unit_test;
void my_test_function() {
BOOST_CHECK(2 == 1);
}
test_suite*
init_unit_test_suite( int argc, char* argv[] )
{
test_suite* test = BOOST_TEST_SUITE( "Master test suite" );
test->add( BOOST_TEST_CASE( &my_test_function ) );
return test;
}
// EOF
我可以通过断点看到它确实运行了单元测试,这很好。 但我不明白为什么它不在输出中显示测试结果。
在 Proj->Props->Linker->System->SubSystem 我给了 /SUBSYSTEM:CONSOLE
谁能告诉我我缺少什么才能在控制台中看到测试的输出。
谢谢
最佳答案
当您单击“绿色箭头”以“调试”模式运行应用程序时,命令提示符会在应用程序退出后关闭。按 Ctrl+F5 或使用“Start without debugging”选项,然后您将看到输出。
关于c++ - boost 单元测试 visual studio 未显示在控制台中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21152061/