19TEST(CheckTests, BuilderSettersRoundTrip)
44 previousTxnLgrSeqValue
57 auto const entry = builder.
build(index);
59 EXPECT_TRUE(entry.validate());
62 auto const& expected = accountValue;
63 auto const actual = entry.getAccount();
68 auto const& expected = destinationValue;
69 auto const actual = entry.getDestination();
74 auto const& expected = sendMaxValue;
75 auto const actual = entry.getSendMax();
80 auto const& expected = sequenceValue;
81 auto const actual = entry.getSequence();
86 auto const& expected = ownerNodeValue;
87 auto const actual = entry.getOwnerNode();
92 auto const& expected = destinationNodeValue;
93 auto const actual = entry.getDestinationNode();
98 auto const& expected = previousTxnIDValue;
99 auto const actual = entry.getPreviousTxnID();
104 auto const& expected = previousTxnLgrSeqValue;
105 auto const actual = entry.getPreviousTxnLgrSeq();
110 auto const& expected = expirationValue;
111 auto const actualOpt = entry.getExpiration();
112 ASSERT_TRUE(actualOpt.has_value());
114 EXPECT_TRUE(entry.hasExpiration());
118 auto const& expected = invoiceIDValue;
119 auto const actualOpt = entry.getInvoiceID();
120 ASSERT_TRUE(actualOpt.has_value());
122 EXPECT_TRUE(entry.hasInvoiceID());
126 auto const& expected = sourceTagValue;
127 auto const actualOpt = entry.getSourceTag();
128 ASSERT_TRUE(actualOpt.has_value());
130 EXPECT_TRUE(entry.hasSourceTag());
134 auto const& expected = destinationTagValue;
135 auto const actualOpt = entry.getDestinationTag();
136 ASSERT_TRUE(actualOpt.has_value());
138 EXPECT_TRUE(entry.hasDestinationTag());
141 EXPECT_TRUE(entry.hasLedgerIndex());
142 auto const ledgerIndex = entry.getLedgerIndex();
143 ASSERT_TRUE(ledgerIndex.has_value());
144 EXPECT_EQ(*ledgerIndex, index);
145 EXPECT_EQ(entry.getKey(), index);
150TEST(CheckTests, BuilderFromSleRoundTrip)
169 sle->at(sfAccount) = accountValue;
170 sle->at(sfDestination) = destinationValue;
171 sle->at(sfSendMax) = sendMaxValue;
172 sle->at(sfSequence) = sequenceValue;
173 sle->at(sfOwnerNode) = ownerNodeValue;
174 sle->at(sfDestinationNode) = destinationNodeValue;
175 sle->at(sfExpiration) = expirationValue;
176 sle->at(sfInvoiceID) = invoiceIDValue;
177 sle->at(sfSourceTag) = sourceTagValue;
178 sle->at(sfDestinationTag) = destinationTagValue;
179 sle->at(sfPreviousTxnID) = previousTxnIDValue;
180 sle->at(sfPreviousTxnLgrSeq) = previousTxnLgrSeqValue;
183 EXPECT_TRUE(builderFromSle.
validate());
185 auto const entryFromBuilder = builderFromSle.
build(index);
187 Check entryFromSle{sle};
188 EXPECT_TRUE(entryFromBuilder.validate());
189 EXPECT_TRUE(entryFromSle.
validate());
192 auto const& expected = accountValue;
194 auto const fromSle = entryFromSle.
getAccount();
195 auto const fromBuilder = entryFromBuilder.getAccount();
202 auto const& expected = destinationValue;
205 auto const fromBuilder = entryFromBuilder.getDestination();
212 auto const& expected = sendMaxValue;
214 auto const fromSle = entryFromSle.
getSendMax();
215 auto const fromBuilder = entryFromBuilder.getSendMax();
222 auto const& expected = sequenceValue;
225 auto const fromBuilder = entryFromBuilder.getSequence();
232 auto const& expected = ownerNodeValue;
235 auto const fromBuilder = entryFromBuilder.getOwnerNode();
242 auto const& expected = destinationNodeValue;
245 auto const fromBuilder = entryFromBuilder.getDestinationNode();
252 auto const& expected = previousTxnIDValue;
255 auto const fromBuilder = entryFromBuilder.getPreviousTxnID();
262 auto const& expected = previousTxnLgrSeqValue;
265 auto const fromBuilder = entryFromBuilder.getPreviousTxnLgrSeq();
272 auto const& expected = expirationValue;
275 auto const fromBuilderOpt = entryFromBuilder.getExpiration();
277 ASSERT_TRUE(fromSleOpt.has_value());
278 ASSERT_TRUE(fromBuilderOpt.has_value());
285 auto const& expected = invoiceIDValue;
288 auto const fromBuilderOpt = entryFromBuilder.getInvoiceID();
290 ASSERT_TRUE(fromSleOpt.has_value());
291 ASSERT_TRUE(fromBuilderOpt.has_value());
298 auto const& expected = sourceTagValue;
301 auto const fromBuilderOpt = entryFromBuilder.getSourceTag();
303 ASSERT_TRUE(fromSleOpt.has_value());
304 ASSERT_TRUE(fromBuilderOpt.has_value());
311 auto const& expected = destinationTagValue;
314 auto const fromBuilderOpt = entryFromBuilder.getDestinationTag();
316 ASSERT_TRUE(fromSleOpt.has_value());
317 ASSERT_TRUE(fromBuilderOpt.has_value());
323 EXPECT_EQ(entryFromSle.
getKey(), index);
324 EXPECT_EQ(entryFromBuilder.getKey(), index);
364TEST(CheckTests, OptionalFieldsReturnNullopt)
383 destinationNodeValue,
385 previousTxnLgrSeqValue
388 auto const entry = builder.
build(index);
391 EXPECT_FALSE(entry.hasExpiration());
392 EXPECT_FALSE(entry.getExpiration().has_value());
393 EXPECT_FALSE(entry.hasInvoiceID());
394 EXPECT_FALSE(entry.getInvoiceID().has_value());
395 EXPECT_FALSE(entry.hasSourceTag());
396 EXPECT_FALSE(entry.getSourceTag().has_value());
397 EXPECT_FALSE(entry.hasDestinationTag());
398 EXPECT_FALSE(entry.getDestinationTag().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.