19TEST(PayChannelTests, BuilderSettersRoundTrip)
48 previousTxnLgrSeqValue
61 EXPECT_TRUE(builder.validate());
63 auto const entry = builder.build(index);
65 EXPECT_TRUE(entry.validate());
68 auto const& expected = accountValue;
69 auto const actual = entry.getAccount();
74 auto const& expected = destinationValue;
75 auto const actual = entry.getDestination();
80 auto const& expected = amountValue;
81 auto const actual = entry.getAmount();
86 auto const& expected = balanceValue;
87 auto const actual = entry.getBalance();
92 auto const& expected = publicKeyValue;
93 auto const actual = entry.getPublicKey();
98 auto const& expected = settleDelayValue;
99 auto const actual = entry.getSettleDelay();
104 auto const& expected = ownerNodeValue;
105 auto const actual = entry.getOwnerNode();
110 auto const& expected = previousTxnIDValue;
111 auto const actual = entry.getPreviousTxnID();
116 auto const& expected = previousTxnLgrSeqValue;
117 auto const actual = entry.getPreviousTxnLgrSeq();
122 auto const& expected = sequenceValue;
123 auto const actualOpt = entry.getSequence();
124 ASSERT_TRUE(actualOpt.has_value());
126 EXPECT_TRUE(entry.hasSequence());
130 auto const& expected = expirationValue;
131 auto const actualOpt = entry.getExpiration();
132 ASSERT_TRUE(actualOpt.has_value());
134 EXPECT_TRUE(entry.hasExpiration());
138 auto const& expected = cancelAfterValue;
139 auto const actualOpt = entry.getCancelAfter();
140 ASSERT_TRUE(actualOpt.has_value());
142 EXPECT_TRUE(entry.hasCancelAfter());
146 auto const& expected = sourceTagValue;
147 auto const actualOpt = entry.getSourceTag();
148 ASSERT_TRUE(actualOpt.has_value());
150 EXPECT_TRUE(entry.hasSourceTag());
154 auto const& expected = destinationTagValue;
155 auto const actualOpt = entry.getDestinationTag();
156 ASSERT_TRUE(actualOpt.has_value());
158 EXPECT_TRUE(entry.hasDestinationTag());
162 auto const& expected = destinationNodeValue;
163 auto const actualOpt = entry.getDestinationNode();
164 ASSERT_TRUE(actualOpt.has_value());
166 EXPECT_TRUE(entry.hasDestinationNode());
169 EXPECT_TRUE(entry.hasLedgerIndex());
170 auto const ledgerIndex = entry.getLedgerIndex();
171 ASSERT_TRUE(ledgerIndex.has_value());
172 EXPECT_EQ(*ledgerIndex, index);
173 EXPECT_EQ(entry.getKey(), index);
178TEST(PayChannelTests, BuilderFromSleRoundTrip)
200 sle->at(sfAccount) = accountValue;
201 sle->at(sfDestination) = destinationValue;
202 sle->at(sfSequence) = sequenceValue;
203 sle->at(sfAmount) = amountValue;
204 sle->at(sfBalance) = balanceValue;
205 sle->at(sfPublicKey) = publicKeyValue;
206 sle->at(sfSettleDelay) = settleDelayValue;
207 sle->at(sfExpiration) = expirationValue;
208 sle->at(sfCancelAfter) = cancelAfterValue;
209 sle->at(sfSourceTag) = sourceTagValue;
210 sle->at(sfDestinationTag) = destinationTagValue;
211 sle->at(sfOwnerNode) = ownerNodeValue;
212 sle->at(sfPreviousTxnID) = previousTxnIDValue;
213 sle->at(sfPreviousTxnLgrSeq) = previousTxnLgrSeqValue;
214 sle->at(sfDestinationNode) = destinationNodeValue;
217 EXPECT_TRUE(builderFromSle.validate());
219 auto const entryFromBuilder = builderFromSle.build(index);
222 EXPECT_TRUE(entryFromBuilder.validate());
223 EXPECT_TRUE(entryFromSle.validate());
226 auto const& expected = accountValue;
228 auto const fromSle = entryFromSle.getAccount();
229 auto const fromBuilder = entryFromBuilder.getAccount();
236 auto const& expected = destinationValue;
238 auto const fromSle = entryFromSle.getDestination();
239 auto const fromBuilder = entryFromBuilder.getDestination();
246 auto const& expected = amountValue;
248 auto const fromSle = entryFromSle.getAmount();
249 auto const fromBuilder = entryFromBuilder.getAmount();
256 auto const& expected = balanceValue;
258 auto const fromSle = entryFromSle.getBalance();
259 auto const fromBuilder = entryFromBuilder.getBalance();
266 auto const& expected = publicKeyValue;
268 auto const fromSle = entryFromSle.getPublicKey();
269 auto const fromBuilder = entryFromBuilder.getPublicKey();
276 auto const& expected = settleDelayValue;
278 auto const fromSle = entryFromSle.getSettleDelay();
279 auto const fromBuilder = entryFromBuilder.getSettleDelay();
286 auto const& expected = ownerNodeValue;
288 auto const fromSle = entryFromSle.getOwnerNode();
289 auto const fromBuilder = entryFromBuilder.getOwnerNode();
296 auto const& expected = previousTxnIDValue;
298 auto const fromSle = entryFromSle.getPreviousTxnID();
299 auto const fromBuilder = entryFromBuilder.getPreviousTxnID();
306 auto const& expected = previousTxnLgrSeqValue;
308 auto const fromSle = entryFromSle.getPreviousTxnLgrSeq();
309 auto const fromBuilder = entryFromBuilder.getPreviousTxnLgrSeq();
316 auto const& expected = sequenceValue;
318 auto const fromSleOpt = entryFromSle.getSequence();
319 auto const fromBuilderOpt = entryFromBuilder.getSequence();
321 ASSERT_TRUE(fromSleOpt.has_value());
322 ASSERT_TRUE(fromBuilderOpt.has_value());
329 auto const& expected = expirationValue;
331 auto const fromSleOpt = entryFromSle.getExpiration();
332 auto const fromBuilderOpt = entryFromBuilder.getExpiration();
334 ASSERT_TRUE(fromSleOpt.has_value());
335 ASSERT_TRUE(fromBuilderOpt.has_value());
342 auto const& expected = cancelAfterValue;
344 auto const fromSleOpt = entryFromSle.getCancelAfter();
345 auto const fromBuilderOpt = entryFromBuilder.getCancelAfter();
347 ASSERT_TRUE(fromSleOpt.has_value());
348 ASSERT_TRUE(fromBuilderOpt.has_value());
355 auto const& expected = sourceTagValue;
357 auto const fromSleOpt = entryFromSle.getSourceTag();
358 auto const fromBuilderOpt = entryFromBuilder.getSourceTag();
360 ASSERT_TRUE(fromSleOpt.has_value());
361 ASSERT_TRUE(fromBuilderOpt.has_value());
368 auto const& expected = destinationTagValue;
370 auto const fromSleOpt = entryFromSle.getDestinationTag();
371 auto const fromBuilderOpt = entryFromBuilder.getDestinationTag();
373 ASSERT_TRUE(fromSleOpt.has_value());
374 ASSERT_TRUE(fromBuilderOpt.has_value());
381 auto const& expected = destinationNodeValue;
383 auto const fromSleOpt = entryFromSle.getDestinationNode();
384 auto const fromBuilderOpt = entryFromBuilder.getDestinationNode();
386 ASSERT_TRUE(fromSleOpt.has_value());
387 ASSERT_TRUE(fromBuilderOpt.has_value());
393 EXPECT_EQ(entryFromSle.getKey(), index);
394 EXPECT_EQ(entryFromBuilder.getKey(), index);