Changeset View
Changeset View
Standalone View
Standalone View
src/test/util/logging.h
- This file was moved from src/test/lib/logging.h.
// Copyright (c) 2019 The Bitcoin Core developers | // Copyright (c) 2019 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_TEST_LIB_LOGGING_H | #ifndef BITCOIN_TEST_UTIL_LOGGING_H | ||||
#define BITCOIN_TEST_LIB_LOGGING_H | #define BITCOIN_TEST_UTIL_LOGGING_H | ||||
#include <util/macros.h> | #include <util/macros.h> | ||||
#include <functional> | #include <functional> | ||||
#include <list> | #include <list> | ||||
#include <string> | #include <string> | ||||
class DebugLogHelper { | class DebugLogHelper { | ||||
const std::string m_message; | const std::string m_message; | ||||
bool m_found{false}; | bool m_found{false}; | ||||
std::list<std::function<void(const std::string &)>>::iterator | std::list<std::function<void(const std::string &)>>::iterator | ||||
m_print_connection; | m_print_connection; | ||||
void check_found(); | void check_found(); | ||||
public: | public: | ||||
DebugLogHelper(std::string message); | DebugLogHelper(std::string message); | ||||
~DebugLogHelper() { check_found(); } | ~DebugLogHelper() { check_found(); } | ||||
}; | }; | ||||
#define ASSERT_DEBUG_LOG(message) \ | #define ASSERT_DEBUG_LOG(message) \ | ||||
DebugLogHelper PASTE2(debugloghelper, __COUNTER__)(message) | DebugLogHelper PASTE2(debugloghelper, __COUNTER__)(message) | ||||
#endif // BITCOIN_TEST_LIB_LOGGING_H | #endif // BITCOIN_TEST_UTIL_LOGGING_H |