20#include <xrpl/beast/unit_test.h>
21#include <xrpl/beast/unit_test/suite.h>
22#include <xrpl/json/json_forwards.h>
23#include <xrpl/protocol/Issue.h>
24#include <xrpl/protocol/STAmount.h>
25#include <xrpl/protocol/STNumber.h>
38 STNumber const before{sfNumber, number};
39 BEAST_EXPECT(number == before);
42 BEAST_EXPECT(s.
size() == 12);
45 BEAST_EXPECT(
after.isEquivalent(before));
46 BEAST_EXPECT(number ==
after);
52 static_assert(!std::is_convertible_v<STNumber*, Number*>);
56 BEAST_EXPECT(stnum.getSType() == STI_NUMBER);
57 BEAST_EXPECT(stnum.getText() ==
"0");
58 BEAST_EXPECT(stnum.isDefault() ==
true);
59 BEAST_EXPECT(stnum.value() ==
Number{0});
78 STNumber const factor{sfNumber, 100};
79 auto const iouValue = strikePrice.iou();
82 BEAST_EXPECT(totalAmount ==
Number{10'000});
157 BEAST_EXPECT(e.
what() == expected);
167 std::string const expected =
"'e' is not a number";
168 BEAST_EXPECT(e.
what() == expected);
178 std::string const expected =
"'1e' is not a number";
179 BEAST_EXPECT(e.
what() == expected);
189 std::string const expected =
"'e2' is not a number";
190 BEAST_EXPECT(e.
what() == expected);
201 BEAST_EXPECT(e.
what() == expected);
208 "1234567890123456789012345678901234567890123456789012345678"
209 "9012345678901234567890123456789012345678901234567890123456"
210 "78901234567890123456789012345678901234567890");
226 std::string const expected =
"'001' is not a number";
227 BEAST_EXPECT(e.
what() == expected);
237 std::string const expected =
"'000.0' is not a number";
238 BEAST_EXPECT(e.
what() == expected);
249 std::string const expected =
"'.1' is not a number";
250 BEAST_EXPECT(e.
what() == expected);
260 std::string const expected =
"'1.' is not a number";
261 BEAST_EXPECT(e.
what() == expected);
271 std::string const expected =
"'1.e3' is not a number";
272 BEAST_EXPECT(e.
what() == expected);
Floating point representation of amounts with high dynamic range.
static constexpr int maxExponent
static constexpr int minExponent
Issue const & issue() const
std::size_t size() const noexcept
Slice slice() const noexcept
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
void testCompile(std::ostream &out)
Issue const & noIssue()
Returns an asset specifier that represents no account and currency.
STNumber numberFromJson(SField const &field, Json::Value const &value)
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
void testCombo(Number number)
void run() override
Runs the suite.