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();
60 IOUAmount const totalValue{iouValue * factor};
62 BEAST_EXPECT(totalAmount ==
Number{10'000});
152 BEAST_EXPECT(e.
what() == expected);
162 std::string const expected =
"'e' is not a number";
163 BEAST_EXPECT(e.
what() == expected);
173 std::string const expected =
"'1e' is not a number";
174 BEAST_EXPECT(e.
what() == expected);
184 std::string const expected =
"'e2' is not a number";
185 BEAST_EXPECT(e.
what() == expected);
196 BEAST_EXPECT(e.
what() == expected);
203 "1234567890123456789012345678901234567890123456789012345678"
204 "9012345678901234567890123456789012345678901234567890123456"
205 "78901234567890123456789012345678901234567890");
221 std::string const expected =
"'001' is not a number";
222 BEAST_EXPECT(e.
what() == expected);
232 std::string const expected =
"'000.0' is not a number";
233 BEAST_EXPECT(e.
what() == expected);
244 std::string const expected =
"'.1' is not a number";
245 BEAST_EXPECT(e.
what() == expected);
255 std::string const expected =
"'1.' is not a number";
256 BEAST_EXPECT(e.
what() == expected);
266 std::string const expected =
"'1.e3' is not a number";
267 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.