MCPcopy Create free account
hub / github.com/andreasfertig/programming-with-cpp20 / Assert

Function Assert

10.11-assert0/main.cpp:9–20  ·  view source on GitHub ↗

#A Assert function taking function, line, condition, and message

Source from the content-addressed store, hash-verified

7// #A Assert function taking function, line, condition, and
8// message
9void Assert(bool condition,
10 std::string_view msg,
11 std::string_view function,
12 int line)
13{
14 if(not condition) {
15 std::clog << function << ':'
16 << line // #B followed by function and line
17 << ": " << msg // #C and the message
18 << '\n';
19 }
20}
21
22// #D Macro wrapper to call Assert
23#define ASSERT(condition, msg) \

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected