没有来自Boost测试的输出(No Output from Boost Test)

编程入门 行业动态 更新时间:2024-10-27 17:13:24
没有来自Boost测试的输出(No Output from Boost Test)

我正在尝试使用boost测试库来实现单元测试。 我开始阅读增强网站上的手册。 在此之后,我在我现有的一个项目中制作了一个简单的测试程序。 我面临的唯一问题是我无法看到测试结果。 我确信我犯了一些错误:)但我无法理解。 以下是我的项目的详细信息

我正在使用visual studio8:我有一个名为MyProject.sln的解决方案

与其他项目一起,我有一个名为MyDLL.vcproj的项目(该项目的类型是DLL

与MYDLL项目中的其他文件一起,我添加一个新的cpp文件名MyTest.cpp ,该文件包含以下代码:

#define BOOST_TEST_DYN_LINK #define BOOST_TEST_MAIN //#define BOOST_TEST_MODULE MyTestTestModue //no need for this maro if above macro is used #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_CASE(SampleTC) { BOOST_CHECK(true); };

我在MYDLL项目属性表中进行了以下更改

C++ -> General -> Additional Include Dependencies = D:\MyProject\Boost\boost\test Linker -> General -> Additional Libray Directories = D:\MyProject\Boost\lib\win32\Debug Linker -> System -> SubSystem = (/SUBSYSTEM:CONSOLE)

我阅读了手册中给出的所有编译细节,但仍然无法获得输出。 理想情况下,我想将Boost测试用作独立的lib(UTF的动态库varian)。

I am trying to implement unit test with boost test libraries. I started by reading the manual at the boost site. After this i make a simple test program in one of my already existing project. The only problem which i face is that i am unable to see the test result. I am sure that i am making some thing wrong :) but i am unable to figure that. Following are the details of my project

I am using visual studio8 for this: I have a solution named MyProject.sln

Along with other projects i have a project named MyDLL.vcproj (The type of this project is DLL)

Along with other files in MYDLL proj i add a new cpp file name MyTest.cpp, the file contains the following code:

#define BOOST_TEST_DYN_LINK #define BOOST_TEST_MAIN //#define BOOST_TEST_MODULE MyTestTestModue //no need for this maro if above macro is used #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_CASE(SampleTC) { BOOST_CHECK(true); };

I make following changes in MYDLL project property sheet

C++ -> General -> Additional Include Dependencies = D:\MyProject\Boost\boost\test Linker -> General -> Additional Libray Directories = D:\MyProject\Boost\lib\win32\Debug Linker -> System -> SubSystem = (/SUBSYSTEM:CONSOLE)

I read all the compilation details given in the manual, but still unable to get the output. Ideally i want to use the Boost test as a standalone lib (Dynamic library varian of UTF).

最满意答案

我确信我犯了一些错误:)

实际上,我认为问题在于你正在做出正确的事情。

您的测试通过,因为检查的值为true ,默认情况下Boost.Test仅输出有关失败的测试的信息。 您需要设置日志级别,可以通过以下两种方式之一完成:将--log_level=all作为测试可执行文件的选项,或将环境变量BOOST_TEST_LOG_LEVEL设置为all 。

有关所有运行时参数,请参阅文档的此页面 。

编辑:它实际上是--log_level(中间有一个下划线)

I am sure that i am making some thing wrong :)

Actually, I think the problem is you are making something right.

Your test passes, because the value checked is true, and by default Boost.Test only outputs information about tests that have failed. You need to set the log level, which can be done one of two ways: passing --log_level=all as an option the the test executable, or setting the environment variable BOOST_TEST_LOG_LEVEL to all.

See this page of the documentation for all the run time parameters.

Edit: It's actually --log_level (with an underscore in the middle)

更多推荐

本文发布于:2023-07-31 02:06:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1340406.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:测试   Boost   Test   Output

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!