19TEST(MPTokenIssuanceTests, BuilderSettersRoundTrip)
41 outstandingAmountValue,
43 previousTxnLgrSeqValue
57 EXPECT_TRUE(builder.validate());
59 auto const entry = builder.build(index);
61 EXPECT_TRUE(entry.validate());
64 auto const& expected = issuerValue;
65 auto const actual = entry.getIssuer();
70 auto const& expected = sequenceValue;
71 auto const actual = entry.getSequence();
76 auto const& expected = ownerNodeValue;
77 auto const actual = entry.getOwnerNode();
82 auto const& expected = outstandingAmountValue;
83 auto const actual = entry.getOutstandingAmount();
88 auto const& expected = previousTxnIDValue;
89 auto const actual = entry.getPreviousTxnID();
94 auto const& expected = previousTxnLgrSeqValue;
95 auto const actual = entry.getPreviousTxnLgrSeq();
100 auto const& expected = transferFeeValue;
101 auto const actualOpt = entry.getTransferFee();
102 ASSERT_TRUE(actualOpt.has_value());
104 EXPECT_TRUE(entry.hasTransferFee());
108 auto const& expected = assetScaleValue;
109 auto const actualOpt = entry.getAssetScale();
110 ASSERT_TRUE(actualOpt.has_value());
112 EXPECT_TRUE(entry.hasAssetScale());
116 auto const& expected = maximumAmountValue;
117 auto const actualOpt = entry.getMaximumAmount();
118 ASSERT_TRUE(actualOpt.has_value());
120 EXPECT_TRUE(entry.hasMaximumAmount());
124 auto const& expected = lockedAmountValue;
125 auto const actualOpt = entry.getLockedAmount();
126 ASSERT_TRUE(actualOpt.has_value());
128 EXPECT_TRUE(entry.hasLockedAmount());
132 auto const& expected = mPTokenMetadataValue;
133 auto const actualOpt = entry.getMPTokenMetadata();
134 ASSERT_TRUE(actualOpt.has_value());
136 EXPECT_TRUE(entry.hasMPTokenMetadata());
140 auto const& expected = domainIDValue;
141 auto const actualOpt = entry.getDomainID();
142 ASSERT_TRUE(actualOpt.has_value());
144 EXPECT_TRUE(entry.hasDomainID());
148 auto const& expected = mutableFlagsValue;
149 auto const actualOpt = entry.getMutableFlags();
150 ASSERT_TRUE(actualOpt.has_value());
152 EXPECT_TRUE(entry.hasMutableFlags());
155 EXPECT_TRUE(entry.hasLedgerIndex());
156 auto const ledgerIndex = entry.getLedgerIndex();
157 ASSERT_TRUE(ledgerIndex.has_value());
158 EXPECT_EQ(*ledgerIndex, index);
159 EXPECT_EQ(entry.getKey(), index);
164TEST(MPTokenIssuanceTests, BuilderFromSleRoundTrip)
184 sle->at(sfIssuer) = issuerValue;
185 sle->at(sfSequence) = sequenceValue;
186 sle->at(sfTransferFee) = transferFeeValue;
187 sle->at(sfOwnerNode) = ownerNodeValue;
188 sle->at(sfAssetScale) = assetScaleValue;
189 sle->at(sfMaximumAmount) = maximumAmountValue;
190 sle->at(sfOutstandingAmount) = outstandingAmountValue;
191 sle->at(sfLockedAmount) = lockedAmountValue;
192 sle->at(sfMPTokenMetadata) = mPTokenMetadataValue;
193 sle->at(sfPreviousTxnID) = previousTxnIDValue;
194 sle->at(sfPreviousTxnLgrSeq) = previousTxnLgrSeqValue;
195 sle->at(sfDomainID) = domainIDValue;
196 sle->at(sfMutableFlags) = mutableFlagsValue;
199 EXPECT_TRUE(builderFromSle.validate());
201 auto const entryFromBuilder = builderFromSle.build(index);
204 EXPECT_TRUE(entryFromBuilder.validate());
205 EXPECT_TRUE(entryFromSle.validate());
208 auto const& expected = issuerValue;
210 auto const fromSle = entryFromSle.getIssuer();
211 auto const fromBuilder = entryFromBuilder.getIssuer();
218 auto const& expected = sequenceValue;
220 auto const fromSle = entryFromSle.getSequence();
221 auto const fromBuilder = entryFromBuilder.getSequence();
228 auto const& expected = ownerNodeValue;
230 auto const fromSle = entryFromSle.getOwnerNode();
231 auto const fromBuilder = entryFromBuilder.getOwnerNode();
238 auto const& expected = outstandingAmountValue;
240 auto const fromSle = entryFromSle.getOutstandingAmount();
241 auto const fromBuilder = entryFromBuilder.getOutstandingAmount();
248 auto const& expected = previousTxnIDValue;
250 auto const fromSle = entryFromSle.getPreviousTxnID();
251 auto const fromBuilder = entryFromBuilder.getPreviousTxnID();
258 auto const& expected = previousTxnLgrSeqValue;
260 auto const fromSle = entryFromSle.getPreviousTxnLgrSeq();
261 auto const fromBuilder = entryFromBuilder.getPreviousTxnLgrSeq();
268 auto const& expected = transferFeeValue;
270 auto const fromSleOpt = entryFromSle.getTransferFee();
271 auto const fromBuilderOpt = entryFromBuilder.getTransferFee();
273 ASSERT_TRUE(fromSleOpt.has_value());
274 ASSERT_TRUE(fromBuilderOpt.has_value());
281 auto const& expected = assetScaleValue;
283 auto const fromSleOpt = entryFromSle.getAssetScale();
284 auto const fromBuilderOpt = entryFromBuilder.getAssetScale();
286 ASSERT_TRUE(fromSleOpt.has_value());
287 ASSERT_TRUE(fromBuilderOpt.has_value());
294 auto const& expected = maximumAmountValue;
296 auto const fromSleOpt = entryFromSle.getMaximumAmount();
297 auto const fromBuilderOpt = entryFromBuilder.getMaximumAmount();
299 ASSERT_TRUE(fromSleOpt.has_value());
300 ASSERT_TRUE(fromBuilderOpt.has_value());
307 auto const& expected = lockedAmountValue;
309 auto const fromSleOpt = entryFromSle.getLockedAmount();
310 auto const fromBuilderOpt = entryFromBuilder.getLockedAmount();
312 ASSERT_TRUE(fromSleOpt.has_value());
313 ASSERT_TRUE(fromBuilderOpt.has_value());
320 auto const& expected = mPTokenMetadataValue;
322 auto const fromSleOpt = entryFromSle.getMPTokenMetadata();
323 auto const fromBuilderOpt = entryFromBuilder.getMPTokenMetadata();
325 ASSERT_TRUE(fromSleOpt.has_value());
326 ASSERT_TRUE(fromBuilderOpt.has_value());
333 auto const& expected = domainIDValue;
335 auto const fromSleOpt = entryFromSle.getDomainID();
336 auto const fromBuilderOpt = entryFromBuilder.getDomainID();
338 ASSERT_TRUE(fromSleOpt.has_value());
339 ASSERT_TRUE(fromBuilderOpt.has_value());
346 auto const& expected = mutableFlagsValue;
348 auto const fromSleOpt = entryFromSle.getMutableFlags();
349 auto const fromBuilderOpt = entryFromBuilder.getMutableFlags();
351 ASSERT_TRUE(fromSleOpt.has_value());
352 ASSERT_TRUE(fromBuilderOpt.has_value());
358 EXPECT_EQ(entryFromSle.getKey(), index);
359 EXPECT_EQ(entryFromBuilder.getKey(), index);
399TEST(MPTokenIssuanceTests, OptionalFieldsReturnNullopt)
414 outstandingAmountValue,
416 previousTxnLgrSeqValue
419 auto const entry = builder.build(index);
422 EXPECT_FALSE(entry.hasTransferFee());
423 EXPECT_FALSE(entry.getTransferFee().has_value());
424 EXPECT_FALSE(entry.hasAssetScale());
425 EXPECT_FALSE(entry.getAssetScale().has_value());
426 EXPECT_FALSE(entry.hasMaximumAmount());
427 EXPECT_FALSE(entry.getMaximumAmount().has_value());
428 EXPECT_FALSE(entry.hasLockedAmount());
429 EXPECT_FALSE(entry.getLockedAmount().has_value());
430 EXPECT_FALSE(entry.hasMPTokenMetadata());
431 EXPECT_FALSE(entry.getMPTokenMetadata().has_value());
432 EXPECT_FALSE(entry.hasDomainID());
433 EXPECT_FALSE(entry.getDomainID().has_value());
434 EXPECT_FALSE(entry.hasMutableFlags());
435 EXPECT_FALSE(entry.getMutableFlags().has_value());