19TEST(DelegateTests, BuilderSettersRoundTrip)
37 previousTxnLgrSeqValue
47 auto const entry = builder.
build(index);
49 EXPECT_TRUE(entry.validate());
52 auto const& expected = accountValue;
53 auto const actual = entry.getAccount();
58 auto const& expected = authorizeValue;
59 auto const actual = entry.getAuthorize();
64 auto const& expected = permissionsValue;
65 auto const actual = entry.getPermissions();
70 auto const& expected = ownerNodeValue;
71 auto const actual = entry.getOwnerNode();
76 auto const& expected = previousTxnIDValue;
77 auto const actual = entry.getPreviousTxnID();
82 auto const& expected = previousTxnLgrSeqValue;
83 auto const actual = entry.getPreviousTxnLgrSeq();
88 auto const& expected = destinationNodeValue;
89 auto const actualOpt = entry.getDestinationNode();
90 ASSERT_TRUE(actualOpt.has_value());
92 EXPECT_TRUE(entry.hasDestinationNode());
95 EXPECT_TRUE(entry.hasLedgerIndex());
96 auto const ledgerIndex = entry.getLedgerIndex();
97 ASSERT_TRUE(ledgerIndex.has_value());
98 EXPECT_EQ(*ledgerIndex, index);
99 EXPECT_EQ(entry.getKey(), index);
104TEST(DelegateTests, BuilderFromSleRoundTrip)
118 sle->at(sfAccount) = accountValue;
119 sle->at(sfAuthorize) = authorizeValue;
120 sle->setFieldArray(sfPermissions, permissionsValue);
121 sle->at(sfOwnerNode) = ownerNodeValue;
122 sle->at(sfDestinationNode) = destinationNodeValue;
123 sle->at(sfPreviousTxnID) = previousTxnIDValue;
124 sle->at(sfPreviousTxnLgrSeq) = previousTxnLgrSeqValue;
127 EXPECT_TRUE(builderFromSle.
validate());
129 auto const entryFromBuilder = builderFromSle.
build(index);
132 EXPECT_TRUE(entryFromBuilder.validate());
133 EXPECT_TRUE(entryFromSle.
validate());
136 auto const& expected = accountValue;
138 auto const fromSle = entryFromSle.
getAccount();
139 auto const fromBuilder = entryFromBuilder.getAccount();
146 auto const& expected = authorizeValue;
149 auto const fromBuilder = entryFromBuilder.getAuthorize();
156 auto const& expected = permissionsValue;
159 auto const fromBuilder = entryFromBuilder.getPermissions();
166 auto const& expected = ownerNodeValue;
169 auto const fromBuilder = entryFromBuilder.getOwnerNode();
176 auto const& expected = previousTxnIDValue;
179 auto const fromBuilder = entryFromBuilder.getPreviousTxnID();
186 auto const& expected = previousTxnLgrSeqValue;
189 auto const fromBuilder = entryFromBuilder.getPreviousTxnLgrSeq();
196 auto const& expected = destinationNodeValue;
199 auto const fromBuilderOpt = entryFromBuilder.getDestinationNode();
201 ASSERT_TRUE(fromSleOpt.has_value());
202 ASSERT_TRUE(fromBuilderOpt.has_value());
208 EXPECT_EQ(entryFromSle.
getKey(), index);
209 EXPECT_EQ(entryFromBuilder.getKey(), index);
bool validate() const
Validate the ledger entry.
uint256 const & getKey() const
Get the key (index) of this ledger entry.
Derived & setLedgerIndex(uint256 const &value)
Set the ledger index.
Derived & setFlags(uint32_t value)
Set the flags.
bool validate() const
Validate the ledger entry.