Bitcoin Core 30.99.0
P2P Digital Currency
util_check_tests.cpp
Go to the documentation of this file.
1// Copyright (c) The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#include <util/check.h>
6
7#include <boost/test/unit_test.hpp>
9
10BOOST_AUTO_TEST_SUITE(util_check_tests)
11
13{
14 Assume(true);
15 Assert(true);
16 CHECK_NONFATAL(true);
17}
18
20{
21 // Disable aborts for easier testing here
23
24 if constexpr (G_ABORT_ON_FAILED_ASSUME) {
25 BOOST_CHECK_EXCEPTION(Assume(false), NonFatalCheckError, HasReason{"Internal bug detected: false"});
26 } else {
28 }
29 BOOST_CHECK_EXCEPTION(Assert(false), NonFatalCheckError, HasReason{"Internal bug detected: false"});
30 BOOST_CHECK_EXCEPTION(CHECK_NONFATAL(false), NonFatalCheckError, HasReason{"Internal bug detected: false"});
31}
32
#define CHECK_NONFATAL(condition)
Identity function.
Definition: check.h:111
#define Assert(val)
Identity function.
Definition: check.h:115
constexpr bool G_ABORT_ON_FAILED_ASSUME
Definition: check.h:24
#define Assume(val)
Assume is the identity function.
Definition: check.h:127
BOOST_CHECK_EXCEPTION predicates to check the specific validation error.
Definition: setup_common.h:293
BOOST_AUTO_TEST_SUITE_END()
#define BOOST_CHECK_NO_THROW(stmt)
Definition: object.cpp:28
BOOST_AUTO_TEST_CASE(check_pass)