mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +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:
@@ -1028,7 +1028,8 @@ struct Escrow_test : public beast::unit_test::suite
|
||||
auto const seq = env.seq(alice);
|
||||
env(escrow(alice, carol, XRP(1000)), finish_time(env.now() + 1s));
|
||||
|
||||
BEAST_EXPECT((*env.meta())[sfTransactionResult] == tesSUCCESS);
|
||||
BEAST_EXPECT((*env.meta())[sfTransactionResult] ==
|
||||
static_cast<std::uint8_t>(tesSUCCESS));
|
||||
|
||||
auto const escrow = env.le(keylet::escrow(alice.id(), seq));
|
||||
BEAST_EXPECT(escrow);
|
||||
@@ -1050,7 +1051,8 @@ struct Escrow_test : public beast::unit_test::suite
|
||||
|
||||
env(escrow(alice, alice, XRP(1000)),
|
||||
finish_time(env.now() + 1s), cancel_time(env.now() + 500s));
|
||||
BEAST_EXPECT((*env.meta())[sfTransactionResult] == tesSUCCESS);
|
||||
BEAST_EXPECT((*env.meta())[sfTransactionResult] ==
|
||||
static_cast<std::uint8_t>(tesSUCCESS));
|
||||
env.close(5s);
|
||||
auto const aa = env.le(keylet::escrow(alice.id(), aseq));
|
||||
BEAST_EXPECT(aa);
|
||||
@@ -1063,7 +1065,8 @@ struct Escrow_test : public beast::unit_test::suite
|
||||
|
||||
env(escrow(bruce, bruce, XRP(1000)),
|
||||
finish_time(env.now() + 1s), cancel_time(env.now() + 2s));
|
||||
BEAST_EXPECT((*env.meta())[sfTransactionResult] == tesSUCCESS);
|
||||
BEAST_EXPECT((*env.meta())[sfTransactionResult] ==
|
||||
static_cast<std::uint8_t>(tesSUCCESS));
|
||||
env.close(5s);
|
||||
auto const bb = env.le(keylet::escrow(bruce.id(), bseq));
|
||||
BEAST_EXPECT(bb);
|
||||
@@ -1078,7 +1081,8 @@ struct Escrow_test : public beast::unit_test::suite
|
||||
env(finish(alice, alice, aseq));
|
||||
{
|
||||
BEAST_EXPECT(!env.le(keylet::escrow(alice.id(), aseq)));
|
||||
BEAST_EXPECT((*env.meta())[sfTransactionResult] == tesSUCCESS);
|
||||
BEAST_EXPECT((*env.meta())[sfTransactionResult] ==
|
||||
static_cast<std::uint8_t>(tesSUCCESS));
|
||||
|
||||
ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id()));
|
||||
BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 0);
|
||||
@@ -1093,7 +1097,8 @@ struct Escrow_test : public beast::unit_test::suite
|
||||
env(cancel(bruce, bruce, bseq));
|
||||
{
|
||||
BEAST_EXPECT(!env.le(keylet::escrow(bruce.id(), bseq)));
|
||||
BEAST_EXPECT((*env.meta())[sfTransactionResult] == tesSUCCESS);
|
||||
BEAST_EXPECT((*env.meta())[sfTransactionResult] ==
|
||||
static_cast<std::uint8_t>(tesSUCCESS));
|
||||
|
||||
ripple::Dir bod(*env.current(), keylet::ownerDir(bruce.id()));
|
||||
BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 0);
|
||||
@@ -1109,11 +1114,13 @@ struct Escrow_test : public beast::unit_test::suite
|
||||
auto const bseq = env.seq(bruce);
|
||||
|
||||
env(escrow(alice, bruce, XRP(1000)), finish_time(env.now() + 1s));
|
||||
BEAST_EXPECT((*env.meta())[sfTransactionResult] == tesSUCCESS);
|
||||
BEAST_EXPECT((*env.meta())[sfTransactionResult] ==
|
||||
static_cast<std::uint8_t>(tesSUCCESS));
|
||||
env.close(5s);
|
||||
env(escrow(bruce, carol, XRP(1000)),
|
||||
finish_time(env.now() + 1s), cancel_time(env.now() + 2s));
|
||||
BEAST_EXPECT((*env.meta())[sfTransactionResult] == tesSUCCESS);
|
||||
BEAST_EXPECT((*env.meta())[sfTransactionResult] ==
|
||||
static_cast<std::uint8_t>(tesSUCCESS));
|
||||
env.close(5s);
|
||||
|
||||
auto const ab = env.le(keylet::escrow(alice.id(), aseq));
|
||||
|
||||
Reference in New Issue
Block a user