46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <fmt/core.h>
|
|
#include <functional>
|
|
#include <source_location>
|
|
|
|
// AKA the Fuckit macro
|
|
#define $F(FMT, ...) fmt::format(FMT, ##__VA_ARGS__)
|
|
|
|
namespace dbc {
|
|
using std::string;
|
|
|
|
using CheckError = std::runtime_error;
|
|
using SentinelError = std::runtime_error;
|
|
using PreCondError = std::runtime_error;
|
|
using PostCondError = std::runtime_error;
|
|
|
|
void log(const string &message,
|
|
const std::source_location location =
|
|
std::source_location::current());
|
|
|
|
[[noreturn]] void sentinel(const string &message,
|
|
const std::source_location location =
|
|
std::source_location::current());
|
|
|
|
void pre(const string &message, bool test,
|
|
const std::source_location location =
|
|
std::source_location::current());
|
|
|
|
void pre(const string &message, std::function<bool()> tester,
|
|
const std::source_location location =
|
|
std::source_location::current());
|
|
|
|
void post(const string &message, bool test,
|
|
const std::source_location location =
|
|
std::source_location::current());
|
|
|
|
void post(const string &message, std::function<bool()> tester,
|
|
const std::source_location location =
|
|
std::source_location::current());
|
|
|
|
void check(bool test, const string &message,
|
|
const std::source_location location =
|
|
std::source_location::current());
|
|
}
|