问题标签 [boost-unit-test-framework]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c++ - 带有 boost::test 的谷歌模拟导致内存泄漏
我正在尝试使用 boost::test 和 google mock 创建单元测试。添加对 InitGoogleMock 的调用会导致 boost 发出一些内存泄漏的信号。我搜索了某种“DeInitGoogleMock”,但没有找到。
为什么会出现这种内存泄漏?如何修复?
主.cpp:
输出:
取消注释 InitGoogleMock 行后的输出:
c++ - 测试完成后如何强制 boost::unit_test 暂停?
从 Visual Studio 运行控制台程序时,控制台显示、程序运行,然后控制台消失,您没有机会看到它。
一般来说,我在main
return 语句之前添加这些行:
当程序使用boost::unit_test
框架编译时,我该如何做类似的事情?由于它main
是库的直接一部分,因此boost
我无法修改它(我想避免boost
为此重新编译)。
cmake - 为什么 CMake 找不到 Boost?
我尝试使用 Boost 单元测试框架来测试我的静态库,但 CMake 无法找到 Boost,尽管BOOST_ROOT, CMAKE_INCLUDE_PATH, CMAKE_LIBRARY_PATH
在调用find_package
. 实际上,我已经根据类似问题的答案尝试了很多选择,但仍然没有成功。
cmake版本:3.6.1
升压版本:1.60.0
CMakeLists.txt:
主.cpp:
SomeClass_test.cpp:
c++ - 我可以访问 BOOST_LOG_TRIVIAL 使用的流实例吗?
是否可以访问 BOOST_LOG_TRIVIAL 使用的底层流实例?
我正在尝试使用 BOOST_LOG_TRIVIAL 让 BOOST 单元测试框架写入输出(我已将其配置为写入文件和 std::clog)
自动& log_stream = ??? // BOOST_LOG_TRIVIAL 流实例 boost::unit_test::unit_test_log.instance().set_stream(log_stream);
boost - 使用 clang-tidy 处理大量与 boost 单元测试相关的警告
我正在建立一个项目。我使用 boost 单元测试进行了骨架测试。不幸的是,宏扩展会产生大量警告。有没有办法禁用这些,而不必指定单独的行号?
即使我有 // NOLINT,也会发生这种情况。
一个例子:
c++ - 如何为 boost 单元测试创建自定义输出/报告格式?
如何为 boost 单元测试创建自定义报告格式?
我正在查看文档,并且只能找到零碎的部分,尚不清楚它们是如何组合在一起的。我想我想要一个unit_test_log_formatter
,但不知道如何添加它。或者也许我想要一个test_observer
,但不知道如何添加它们。
我真的只想在测试输出结束时总结错误。正常报告中有太多输出,我正在寻找输出中的错误。
c++ - 使用夹具时提升单元测试过滤器
我需要指定一个特定的单元测试来运行。当然,我在查看文档后查看了 Stack Overflow Answers,但都没有使用固定装置。
如果我有以下情况,如何指定要运行的测试用例:
如果我通过--run_test=add_remove
了,该过程返回一条消息测试设置错误:没有测试用例匹配过滤器或所有测试用例都被禁用。
c++ - Issue with BOOST unit_test_framework / Google Test on macOS Mojave
During a build process (unit tests) there are a bunch of errors like:
"error: no member named 'xxx' in the global namespace
using::xxx;" ('xxx' is a type, e.g. uint8_t).
DETAILS:
- in case if I include only <boost/test/unit_test.hpp>, the source of error is in the file /Library/Developer/CommandLineTools/usr/include/c++/v1/cstdint
- in case if I include <boost/cstdint.hpp> before , the source of error is in the file /usr/local/include/boost/cstdint.hpp
ENVIRONMENT:
- macOS Mojave
- compiler: clang
- CXX_STANDARD: 11 / 14
- boost v.1.67.0_1 (installed using homebrew to default location - usr/local/Cellar/)
UPD: The same issue (with cstdint) happens with using Google Test (1.8.1)
c++ - Boost 1.64 单元测试编译失败
我开始阅读此处介绍的 boost 单元测试教程。
使用我的初始代码:
当我编译它时,我收到以下错误:
我自己编译了 boost,由于其他依赖限制,我使用的是 1.64 版。我也在使用 Visual Studio 2017 社区。
请问我该如何解决这个问题?
提前致谢。
c++ - 如何在 std::string 或 char* 中与 BOOST 框架进行比较(使用 boost/test/unit_test.hpp)
如何使用 BOOST 单元测试框架(使用)将std::string
或* 与 liternal 字符串进行比较,char
boost/test/unit_test.hpp
BOOST_CHECK
并且BOOST_TEST
不适用于字符串。