debug: add breakpoints on CHECK failures again
This commit is contained in:
parent
38e1a19e37
commit
0eb7fdf5cd
24
debug.hpp
24
debug.hpp
@ -146,6 +146,7 @@
|
|||||||
std::cerr << "expected equality\n" \
|
std::cerr << "expected equality\n" \
|
||||||
"__a: " #A " is " << __a << "\n" \
|
"__a: " #A " is " << __a << "\n" \
|
||||||
"__b: " #B " is " << __b << "\n"; \
|
"__b: " #B " is " << __b << "\n"; \
|
||||||
|
breakpoint (); \
|
||||||
} \
|
} \
|
||||||
); \
|
); \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -161,6 +162,7 @@
|
|||||||
std::cerr << "expected less than\n" \
|
std::cerr << "expected less than\n" \
|
||||||
"__a: " << #A << " is " << __a << "\n" \
|
"__a: " << #A << " is " << __a << "\n" \
|
||||||
"__b: " << #B << " is " << __b << "\n"; \
|
"__b: " << #B << " is " << __b << "\n"; \
|
||||||
|
breakpoint (); \
|
||||||
}; \
|
}; \
|
||||||
); \
|
); \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -176,6 +178,7 @@
|
|||||||
std::cerr << "expected less than or equal\n" \
|
std::cerr << "expected less than or equal\n" \
|
||||||
"__a: " << #A << " is " << __a << "\n" \
|
"__a: " << #A << " is " << __a << "\n" \
|
||||||
"__b: " << #B << " is " << __b << "\n"; \
|
"__b: " << #B << " is " << __b << "\n"; \
|
||||||
|
breakpoint (); \
|
||||||
} \
|
} \
|
||||||
); \
|
); \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -191,6 +194,7 @@
|
|||||||
std::cerr << "expected greater than\n" \
|
std::cerr << "expected greater than\n" \
|
||||||
"__a: " << #A << " is " << __a << "\n" \
|
"__a: " << #A << " is " << __a << "\n" \
|
||||||
"__b: " << #B << " is " << __b << "\n"; \
|
"__b: " << #B << " is " << __b << "\n"; \
|
||||||
|
breakpoint (); \
|
||||||
} \
|
} \
|
||||||
); \
|
); \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -206,6 +210,7 @@
|
|||||||
std::cerr << "expected greater or equal\n" \
|
std::cerr << "expected greater or equal\n" \
|
||||||
"__a: " << #A << " is " << __a << "\n" \
|
"__a: " << #A << " is " << __a << "\n" \
|
||||||
"__b: " << #B << " is " << __b << "\n"; \
|
"__b: " << #B << " is " << __b << "\n"; \
|
||||||
|
breakpoint (); \
|
||||||
}; \
|
}; \
|
||||||
); \
|
); \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -223,6 +228,7 @@
|
|||||||
"__l: " << #L << " is " << +__l << "\n" \
|
"__l: " << #L << " is " << +__l << "\n" \
|
||||||
"__h: " << #H << " is " << +__h << "\n" \
|
"__h: " << #H << " is " << +__h << "\n" \
|
||||||
"__v: " << #V << " is " << +__v << "\n"; \
|
"__v: " << #V << " is " << +__v << "\n"; \
|
||||||
|
breakpoint (); \
|
||||||
}; \
|
}; \
|
||||||
); \
|
); \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -237,6 +243,7 @@
|
|||||||
std::cerr << "expected inequality\n" \
|
std::cerr << "expected inequality\n" \
|
||||||
"__a: " << #A << " is " << __a << "\n" \
|
"__a: " << #A << " is " << __a << "\n" \
|
||||||
"__b: " << #B << " is " << __b << "\n"; \
|
"__b: " << #B << " is " << __b << "\n"; \
|
||||||
|
breakpoint (); \
|
||||||
}; \
|
}; \
|
||||||
); \
|
); \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -250,6 +257,7 @@
|
|||||||
if (!::util::almost_zero (__a)) { \
|
if (!::util::almost_zero (__a)) { \
|
||||||
std::cerr << "expected zero\n" \
|
std::cerr << "expected zero\n" \
|
||||||
"__a: " << #A << " is " << __a << "\n"; \
|
"__a: " << #A << " is " << __a << "\n"; \
|
||||||
|
breakpoint (); \
|
||||||
}; \
|
}; \
|
||||||
); \
|
); \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -260,9 +268,11 @@
|
|||||||
DEBUG_ONLY ( \
|
DEBUG_ONLY ( \
|
||||||
const auto &__a = (A); \
|
const auto &__a = (A); \
|
||||||
\
|
\
|
||||||
if (::util::exactly_zero (__a)) \
|
if (::util::exactly_zero (__a)) { \
|
||||||
std::cerr << "expected non-zero\n" \
|
std::cerr << "expected non-zero\n" \
|
||||||
"__a: " << #A << " is " << __a << '\n'; \
|
"__a: " << #A << " is " << __a << '\n'; \
|
||||||
|
breakpoint (); \
|
||||||
|
} \
|
||||||
); \
|
); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -273,10 +283,12 @@
|
|||||||
const auto &__check_mod_v = (V); \
|
const auto &__check_mod_v = (V); \
|
||||||
const auto &__check_mod_m = (M); \
|
const auto &__check_mod_m = (M); \
|
||||||
\
|
\
|
||||||
if (!::util::exactly_zero (__check_mod_v % __check_mod_m)) \
|
if (!::util::exactly_zero (__check_mod_v % __check_mod_m)) { \
|
||||||
std::cerr << "expected zero modulus\n" \
|
std::cerr << "expected zero modulus\n" \
|
||||||
"__v: " << #V << " is " << __check_mod_v << "\n" \
|
"__v: " << #V << " is " << __check_mod_v << "\n" \
|
||||||
"__m: " << #M << " is " << __check_mod_m << "\n"; \
|
"__m: " << #M << " is " << __check_mod_m << "\n"; \
|
||||||
|
breakpoint (); \
|
||||||
|
} \
|
||||||
); \
|
); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -292,6 +304,7 @@
|
|||||||
__c) == std::end (__e)) { \
|
__c) == std::end (__e)) { \
|
||||||
std::cerr << "expect enum\n" \
|
std::cerr << "expect enum\n" \
|
||||||
"__c: " << #C << " is " << __c << '\n'; \
|
"__c: " << #C << " is " << __c << '\n'; \
|
||||||
|
breakpoint (); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
@ -305,6 +318,7 @@
|
|||||||
if (!std::isfinite (__v)) { \
|
if (!std::isfinite (__v)) { \
|
||||||
std::cerr << "expected finite value\n" \
|
std::cerr << "expected finite value\n" \
|
||||||
"__v: " << #V << " is " << __v << '\n'; \
|
"__v: " << #V << " is " << __v << '\n'; \
|
||||||
|
breakpoint (); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
@ -324,8 +338,10 @@
|
|||||||
catch (E const&) \
|
catch (E const&) \
|
||||||
{ caught = true; } \
|
{ caught = true; } \
|
||||||
\
|
\
|
||||||
if (!caught) \
|
if (!caught) { \
|
||||||
std::cerr << "expected exception: " << #E << '\n' \
|
std::cerr << "expected exception: " << #E << '\n' \
|
||||||
|
breakpoint (); \
|
||||||
|
} \
|
||||||
); \
|
); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -337,8 +353,10 @@
|
|||||||
C; \
|
C; \
|
||||||
} catch (const std::exception &e) { \
|
} catch (const std::exception &e) { \
|
||||||
std::cerr << "unexpected exception: " << e.what () << '\n'; \
|
std::cerr << "unexpected exception: " << e.what () << '\n'; \
|
||||||
|
breakpoint (); \
|
||||||
} catch (...) { \
|
} catch (...) { \
|
||||||
std::cerr << "unexpected exception: unknown\n"; \
|
std::cerr << "unexpected exception: unknown\n"; \
|
||||||
|
breakpoint (); \
|
||||||
} \
|
} \
|
||||||
); \
|
); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
Loading…
Reference in New Issue
Block a user