1#include <xrpl/beast/unit_test.h>
2#include <xrpl/beast/unit_test/suite.h>
3#include <xrpl/json/json_forwards.h>
4#include <xrpl/protocol/Issue.h>
5#include <xrpl/protocol/SField.h>
6#include <xrpl/protocol/STAmount.h>
7#include <xrpl/protocol/STNumber.h>
20 STNumber const before{sfNumber, number};
21 BEAST_EXPECT(number == before);
24 BEAST_EXPECT(s.
size() == 12);
27 BEAST_EXPECT(
after.isEquivalent(before));
28 BEAST_EXPECT(number ==
after);
36 BEAST_EXPECT(stnum.getSType() == STI_NUMBER);
37 BEAST_EXPECT(stnum.getText() ==
"0");
38 BEAST_EXPECT(stnum.isDefault() ==
true);
39 BEAST_EXPECT(stnum.value() ==
Number{0});
58 STNumber const factor{sfNumber, 100};
59 auto const iouValue = strikePrice.iou();
62 BEAST_EXPECT(totalAmount ==
Number{10'000});
150 sfNumber,
Number{9'223'372'036'854'775'807, 0}));
157 9'223'372'036'854'775'808ULL,
196 BEAST_EXPECT(e.
what() == expected);
206 std::string const expected =
"'e' is not a number";
207 BEAST_EXPECT(e.
what() == expected);
217 std::string const expected =
"'1e' is not a number";
218 BEAST_EXPECT(e.
what() == expected);
228 std::string const expected =
"'e2' is not a number";
229 BEAST_EXPECT(e.
what() == expected);
240 BEAST_EXPECT(e.
what() == expected);
247 "1234567890123456789012345678901234567890123456789012345678"
248 "9012345678901234567890123456789012345678901234567890123456"
249 "78901234567890123456789012345678901234567890");
265 std::string const expected =
"'001' is not a number";
266 BEAST_EXPECT(e.
what() == expected);
276 std::string const expected =
"'000.0' is not a number";
277 BEAST_EXPECT(e.
what() == expected);
288 std::string const expected =
"'.1' is not a number";
289 BEAST_EXPECT(e.
what() == expected);
299 std::string const expected =
"'1.' is not a number";
300 BEAST_EXPECT(e.
what() == expected);
310 std::string const expected =
"'1.e3' is not a number";
311 BEAST_EXPECT(e.
what() == expected);
testcase_t testcase
Memberspace for declaring test cases.
Floating point representation of amounts with high dynamic range.
Sets the new scale and restores the old scale when it leaves scope.
Number is a floating point type that can represent a wide range of values.
static constexpr int minExponent
static constexpr int maxExponent
static MantissaRange::mantissa_scale getMantissaScale()
Returns which mantissa scale is currently in use for normalization.
Issue const & issue() const
Slice slice() const noexcept
std::size_t size() const noexcept
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string to_string(base_uint< Bits, Tag > const &a)
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
STNumber numberFromJson(SField const &field, Json::Value const &value)
Issue const & noIssue()
Returns an asset specifier that represents no account and currency.
void testCombo(Number number)
void run() override
Runs the suite.