mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-29 07:25:51 +00:00
Compile time check preflight returns no tec (RIPD-1624):
The six different ranges of TER codes are broken up into six different enumerations. A template class allows subsets of these enumerations to be aggregated. This technique allows verification at compile time that no TEC codes are returned before the signature is checked. Conversion between TER instance and integer is provided by named functions. This makes accidental conversion almost impossible and makes type abuse easier to spot in the code base.
This commit is contained in:
@@ -94,15 +94,16 @@ class Invariants_test : public beast::unit_test::suite
|
||||
|
||||
BEAST_EXPECT(precheck(A1, A2, ac));
|
||||
|
||||
auto tr = tesSUCCESS;
|
||||
TER tr = tesSUCCESS;
|
||||
// invoke check twice to cover tec and tef cases
|
||||
for (auto i : {0,1})
|
||||
{
|
||||
tr = ac.checkInvariants(tr);
|
||||
if (enabled)
|
||||
{
|
||||
BEAST_EXPECT(
|
||||
tr == (i == 0 ? tecINVARIANT_FAILED : tefINVARIANT_FAILED));
|
||||
BEAST_EXPECT(tr == (i == 0
|
||||
? TER {tecINVARIANT_FAILED}
|
||||
: TER {tefINVARIANT_FAILED}));
|
||||
BEAST_EXPECT(
|
||||
boost::starts_with(sink.strm_.str(), "Invariant failed:") ||
|
||||
boost::starts_with(sink.strm_.str(),
|
||||
|
||||
Reference in New Issue
Block a user