mirror of
https://github.com/OpenVPN/openvpn3.git
synced 2024-09-20 12:12:15 +02:00
unittests: added THROW_FMT(...) convenience macro to throw an exception with printf-style argument substitution
Example: if (expect_throw != actual_throw) THROW_FMT("validate_size: bad throw, expect=%s, actual=%s, FC=%s size=%s", expect_throw, actual_throw, fc.info(), size); Signed-off-by: James Yonan <james@openvpn.net>
This commit is contained in:
parent
3cd0652d1e
commit
95852fd24a
@ -24,6 +24,7 @@
|
||||
#include <openvpn/io/io.hpp>
|
||||
#include <openvpn/common/exception.hpp>
|
||||
#include <openvpn/common/hexstr.hpp>
|
||||
#include <openvpn/common/format.hpp>
|
||||
#include <openvpn/random/mtrandapi.hpp>
|
||||
|
||||
#include <iostream>
|
||||
@ -409,3 +410,6 @@ do { \
|
||||
if ((v1) < (v2)) \
|
||||
OPENVPN_THROW_EXCEPTION("JY_ASSERT_GE: failure at " << __FILE__ << ':' << __LINE__); \
|
||||
} while (0)
|
||||
|
||||
// Convenience macro for throwing exceptions
|
||||
#define THROW_FMT(...) throw Exception(printfmt(__VA_ARGS__))
|
||||
|
Loading…
Reference in New Issue
Block a user