Fixed that crash and cleaned up more variables for some study next. I might also try out my debug macros.

This commit is contained in:
Zed A. Shaw 2025-01-18 00:44:25 -05:00
parent 7fb2d5cf26
commit 7a74877849
9 changed files with 162 additions and 92729 deletions

14
dbc.cpp
View file

@ -1,17 +1,20 @@
#include "dbc.hpp"
#include <iostream>
void dbc::log(const string &message) {
fmt::print("{}\n", message);
std::cerr << "!!!!!!!!!!" << message << std::endl;
}
void dbc::sentinel(const string &message) {
string err = fmt::format("[SENTINEL!] {}\n", message);
string err = fmt::format("[SENTINEL!] {}", message);
dbc::log(err);
throw dbc::SentinelError{err};
}
void dbc::pre(const string &message, bool test) {
if(!test) {
string err = fmt::format("[PRE!] {}\n", message);
string err = fmt::format("[PRE!] {}", message);
dbc::log(err);
throw dbc::PreCondError{err};
}
}
@ -22,7 +25,8 @@ void dbc::pre(const string &message, std::function<bool()> tester) {
void dbc::post(const string &message, bool test) {
if(!test) {
string err = fmt::format("[POST!] {}\n", message);
string err = fmt::format("[POST!] {}", message);
dbc::log(err);
throw dbc::PostCondError{err};
}
}
@ -34,7 +38,7 @@ void dbc::post(const string &message, std::function<bool()> tester) {
void dbc::check(bool test, const string &message) {
if(!test) {
string err = fmt::format("[CHECK!] {}\n", message);
fmt::println("{}", err);
dbc::log(err);
throw dbc::CheckError{err};
}
}