19TEST(SponsorshipTests, BuilderSettersRoundTrip)
35 previousTxnLgrSeqValue,
51 auto const entry = builder.
build(index);
53 EXPECT_TRUE(entry.validate());
56 auto const& expected = previousTxnIDValue;
57 auto const actual = entry.getPreviousTxnID();
62 auto const& expected = previousTxnLgrSeqValue;
63 auto const actual = entry.getPreviousTxnLgrSeq();
68 auto const& expected = ownerValue;
69 auto const actual = entry.getOwner();
74 auto const& expected = sponseeValue;
75 auto const actual = entry.getSponsee();
80 auto const& expected = ownerNodeValue;
81 auto const actual = entry.getOwnerNode();
86 auto const& expected = sponseeNodeValue;
87 auto const actual = entry.getSponseeNode();
92 auto const& expected = feeAmountValue;
93 auto const actualOpt = entry.getFeeAmount();
94 ASSERT_TRUE(actualOpt.has_value());
96 EXPECT_TRUE(entry.hasFeeAmount());
100 auto const& expected = maxFeeValue;
101 auto const actualOpt = entry.getMaxFee();
102 ASSERT_TRUE(actualOpt.has_value());
104 EXPECT_TRUE(entry.hasMaxFee());
108 auto const& expected = remainingOwnerCountValue;
109 auto const actualOpt = entry.getRemainingOwnerCount();
110 ASSERT_TRUE(actualOpt.has_value());
112 EXPECT_TRUE(entry.hasRemainingOwnerCount());
115 EXPECT_TRUE(entry.hasLedgerIndex());
116 auto const ledgerIndex = entry.getLedgerIndex();
117 ASSERT_TRUE(ledgerIndex.has_value());
118 EXPECT_EQ(*ledgerIndex, index);
119 EXPECT_EQ(entry.getKey(), index);
124TEST(SponsorshipTests, BuilderFromSleRoundTrip)
140 sle->at(sfPreviousTxnID) = previousTxnIDValue;
141 sle->at(sfPreviousTxnLgrSeq) = previousTxnLgrSeqValue;
142 sle->at(sfOwner) = ownerValue;
143 sle->at(sfSponsee) = sponseeValue;
144 sle->at(sfFeeAmount) = feeAmountValue;
145 sle->at(sfMaxFee) = maxFeeValue;
146 sle->at(sfRemainingOwnerCount) = remainingOwnerCountValue;
147 sle->at(sfOwnerNode) = ownerNodeValue;
148 sle->at(sfSponseeNode) = sponseeNodeValue;
151 EXPECT_TRUE(builderFromSle.
validate());
153 auto const entryFromBuilder = builderFromSle.
build(index);
156 EXPECT_TRUE(entryFromBuilder.validate());
157 EXPECT_TRUE(entryFromSle.
validate());
160 auto const& expected = previousTxnIDValue;
163 auto const fromBuilder = entryFromBuilder.getPreviousTxnID();
170 auto const& expected = previousTxnLgrSeqValue;
173 auto const fromBuilder = entryFromBuilder.getPreviousTxnLgrSeq();
180 auto const& expected = ownerValue;
182 auto const fromSle = entryFromSle.
getOwner();
183 auto const fromBuilder = entryFromBuilder.getOwner();
190 auto const& expected = sponseeValue;
192 auto const fromSle = entryFromSle.
getSponsee();
193 auto const fromBuilder = entryFromBuilder.getSponsee();
200 auto const& expected = ownerNodeValue;
203 auto const fromBuilder = entryFromBuilder.getOwnerNode();
210 auto const& expected = sponseeNodeValue;
213 auto const fromBuilder = entryFromBuilder.getSponseeNode();
220 auto const& expected = feeAmountValue;
223 auto const fromBuilderOpt = entryFromBuilder.getFeeAmount();
225 ASSERT_TRUE(fromSleOpt.has_value());
226 ASSERT_TRUE(fromBuilderOpt.has_value());
233 auto const& expected = maxFeeValue;
235 auto const fromSleOpt = entryFromSle.
getMaxFee();
236 auto const fromBuilderOpt = entryFromBuilder.getMaxFee();
238 ASSERT_TRUE(fromSleOpt.has_value());
239 ASSERT_TRUE(fromBuilderOpt.has_value());
246 auto const& expected = remainingOwnerCountValue;
249 auto const fromBuilderOpt = entryFromBuilder.getRemainingOwnerCount();
251 ASSERT_TRUE(fromSleOpt.has_value());
252 ASSERT_TRUE(fromBuilderOpt.has_value());
258 EXPECT_EQ(entryFromSle.
getKey(), index);
259 EXPECT_EQ(entryFromBuilder.getKey(), index);
299TEST(SponsorshipTests, OptionalFieldsReturnNullopt)
312 previousTxnLgrSeqValue,
319 auto const entry = builder.
build(index);
322 EXPECT_FALSE(entry.hasFeeAmount());
323 EXPECT_FALSE(entry.getFeeAmount().has_value());
324 EXPECT_FALSE(entry.hasMaxFee());
325 EXPECT_FALSE(entry.getMaxFee().has_value());
326 EXPECT_FALSE(entry.hasRemainingOwnerCount());
327 EXPECT_FALSE(entry.getRemainingOwnerCount().has_value());
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.