compat.boost-assert
#includeBoost.Assert 1.92.0 — configurable assert macros with source-location support
#include <boost/assert.hpp>
mcpp add compat.boost-assert@1.92.0
用法
来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。
// Behavioral test: BOOST_VERIFY's expression is evaluated in ALL build modes
// (unlike BOOST_ASSERT, which compiles away under NDEBUG), and the
// source_location / current_function utilities return live data.
#include <boost/assert.hpp>
#include <boost/assert/source_location.hpp>
#include <boost/current_function.hpp>
static int answer() { return 42; }
int main() {
bool ran = false;
BOOST_VERIFY(answer() == 42 && (ran = true)); // must run even under NDEBUG
const char* fn = BOOST_CURRENT_FUNCTION;
bool fn_ok = fn != nullptr && *fn != '\0';
constexpr boost::source_location loc = BOOST_CURRENT_LOCATION;
bool loc_ok = loc.file_name() != nullptr && loc.line() > 0;
return (ran && fn_ok && loc_ok) ? 0 : 1;
}
tests/examples/boost-assert/tests/assert.cpp · 项目 tests/examples/boost-assert
构建
- targets
boost_assert (lib)- language
c++20- import std
- no
- include dirs
*/include
源文件 (1)
mcpp_generated/boost_assert_anchor.cpp
生成的文件
mcpp_generated/boost_assert_anchor.cpp
版本
| 版本 | 平台 | 镜像 | sha256 |
|---|---|---|---|
1.92.0 最新 |
LinuxWindowsmacOS | 源站 | 8d49fc69df12… |