19TEST(RippleStateTests, BuilderSettersRoundTrip)
40 previousTxnLgrSeqValue
53 EXPECT_TRUE(builder.validate());
55 auto const entry = builder.build(index);
57 EXPECT_TRUE(entry.validate());
60 auto const& expected = balanceValue;
61 auto const actual = entry.getBalance();
66 auto const& expected = lowLimitValue;
67 auto const actual = entry.getLowLimit();
72 auto const& expected = highLimitValue;
73 auto const actual = entry.getHighLimit();
78 auto const& expected = previousTxnIDValue;
79 auto const actual = entry.getPreviousTxnID();
84 auto const& expected = previousTxnLgrSeqValue;
85 auto const actual = entry.getPreviousTxnLgrSeq();
90 auto const& expected = lowNodeValue;
91 auto const actualOpt = entry.getLowNode();
92 ASSERT_TRUE(actualOpt.has_value());
94 EXPECT_TRUE(entry.hasLowNode());
98 auto const& expected = lowQualityInValue;
99 auto const actualOpt = entry.getLowQualityIn();
100 ASSERT_TRUE(actualOpt.has_value());
102 EXPECT_TRUE(entry.hasLowQualityIn());
106 auto const& expected = lowQualityOutValue;
107 auto const actualOpt = entry.getLowQualityOut();
108 ASSERT_TRUE(actualOpt.has_value());
110 EXPECT_TRUE(entry.hasLowQualityOut());
114 auto const& expected = highNodeValue;
115 auto const actualOpt = entry.getHighNode();
116 ASSERT_TRUE(actualOpt.has_value());
118 EXPECT_TRUE(entry.hasHighNode());
122 auto const& expected = highQualityInValue;
123 auto const actualOpt = entry.getHighQualityIn();
124 ASSERT_TRUE(actualOpt.has_value());
126 EXPECT_TRUE(entry.hasHighQualityIn());
130 auto const& expected = highQualityOutValue;
131 auto const actualOpt = entry.getHighQualityOut();
132 ASSERT_TRUE(actualOpt.has_value());
134 EXPECT_TRUE(entry.hasHighQualityOut());
137 EXPECT_TRUE(entry.hasLedgerIndex());
138 auto const ledgerIndex = entry.getLedgerIndex();
139 ASSERT_TRUE(ledgerIndex.has_value());
140 EXPECT_EQ(*ledgerIndex, index);
141 EXPECT_EQ(entry.getKey(), index);
146TEST(RippleStateTests, BuilderFromSleRoundTrip)
164 sle->at(sfBalance) = balanceValue;
165 sle->at(sfLowLimit) = lowLimitValue;
166 sle->at(sfHighLimit) = highLimitValue;
167 sle->at(sfPreviousTxnID) = previousTxnIDValue;
168 sle->at(sfPreviousTxnLgrSeq) = previousTxnLgrSeqValue;
169 sle->at(sfLowNode) = lowNodeValue;
170 sle->at(sfLowQualityIn) = lowQualityInValue;
171 sle->at(sfLowQualityOut) = lowQualityOutValue;
172 sle->at(sfHighNode) = highNodeValue;
173 sle->at(sfHighQualityIn) = highQualityInValue;
174 sle->at(sfHighQualityOut) = highQualityOutValue;
177 EXPECT_TRUE(builderFromSle.validate());
179 auto const entryFromBuilder = builderFromSle.build(index);
182 EXPECT_TRUE(entryFromBuilder.validate());
183 EXPECT_TRUE(entryFromSle.validate());
186 auto const& expected = balanceValue;
188 auto const fromSle = entryFromSle.getBalance();
189 auto const fromBuilder = entryFromBuilder.getBalance();
196 auto const& expected = lowLimitValue;
198 auto const fromSle = entryFromSle.getLowLimit();
199 auto const fromBuilder = entryFromBuilder.getLowLimit();
206 auto const& expected = highLimitValue;
208 auto const fromSle = entryFromSle.getHighLimit();
209 auto const fromBuilder = entryFromBuilder.getHighLimit();
216 auto const& expected = previousTxnIDValue;
218 auto const fromSle = entryFromSle.getPreviousTxnID();
219 auto const fromBuilder = entryFromBuilder.getPreviousTxnID();
226 auto const& expected = previousTxnLgrSeqValue;
228 auto const fromSle = entryFromSle.getPreviousTxnLgrSeq();
229 auto const fromBuilder = entryFromBuilder.getPreviousTxnLgrSeq();
236 auto const& expected = lowNodeValue;
238 auto const fromSleOpt = entryFromSle.getLowNode();
239 auto const fromBuilderOpt = entryFromBuilder.getLowNode();
241 ASSERT_TRUE(fromSleOpt.has_value());
242 ASSERT_TRUE(fromBuilderOpt.has_value());
249 auto const& expected = lowQualityInValue;
251 auto const fromSleOpt = entryFromSle.getLowQualityIn();
252 auto const fromBuilderOpt = entryFromBuilder.getLowQualityIn();
254 ASSERT_TRUE(fromSleOpt.has_value());
255 ASSERT_TRUE(fromBuilderOpt.has_value());
262 auto const& expected = lowQualityOutValue;
264 auto const fromSleOpt = entryFromSle.getLowQualityOut();
265 auto const fromBuilderOpt = entryFromBuilder.getLowQualityOut();
267 ASSERT_TRUE(fromSleOpt.has_value());
268 ASSERT_TRUE(fromBuilderOpt.has_value());
275 auto const& expected = highNodeValue;
277 auto const fromSleOpt = entryFromSle.getHighNode();
278 auto const fromBuilderOpt = entryFromBuilder.getHighNode();
280 ASSERT_TRUE(fromSleOpt.has_value());
281 ASSERT_TRUE(fromBuilderOpt.has_value());
288 auto const& expected = highQualityInValue;
290 auto const fromSleOpt = entryFromSle.getHighQualityIn();
291 auto const fromBuilderOpt = entryFromBuilder.getHighQualityIn();
293 ASSERT_TRUE(fromSleOpt.has_value());
294 ASSERT_TRUE(fromBuilderOpt.has_value());
301 auto const& expected = highQualityOutValue;
303 auto const fromSleOpt = entryFromSle.getHighQualityOut();
304 auto const fromBuilderOpt = entryFromBuilder.getHighQualityOut();
306 ASSERT_TRUE(fromSleOpt.has_value());
307 ASSERT_TRUE(fromBuilderOpt.has_value());
313 EXPECT_EQ(entryFromSle.getKey(), index);
314 EXPECT_EQ(entryFromBuilder.getKey(), index);
354TEST(RippleStateTests, OptionalFieldsReturnNullopt)
369 previousTxnLgrSeqValue
372 auto const entry = builder.build(index);
375 EXPECT_FALSE(entry.hasLowNode());
376 EXPECT_FALSE(entry.getLowNode().has_value());
377 EXPECT_FALSE(entry.hasLowQualityIn());
378 EXPECT_FALSE(entry.getLowQualityIn().has_value());
379 EXPECT_FALSE(entry.hasLowQualityOut());
380 EXPECT_FALSE(entry.getLowQualityOut().has_value());
381 EXPECT_FALSE(entry.hasHighNode());
382 EXPECT_FALSE(entry.getHighNode().has_value());
383 EXPECT_FALSE(entry.hasHighQualityIn());
384 EXPECT_FALSE(entry.getHighQualityIn().has_value());
385 EXPECT_FALSE(entry.hasHighQualityOut());
386 EXPECT_FALSE(entry.getHighQualityOut().has_value());
std::shared_ptr< SLE const > getSle() const
Get the underlying SLE object.