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});
53 STNumber const factor{sfNumber, 100};
54 auto const iouValue = strikePrice.iou();
57 BEAST_EXPECT(totalAmount ==
Number{10'000});
136 BEAST_EXPECT(e.
what() == expected);
146 std::string const expected =
"'e' is not a number";
147 BEAST_EXPECT(e.
what() == expected);
157 std::string const expected =
"'1e' is not a number";
158 BEAST_EXPECT(e.
what() == expected);
168 std::string const expected =
"'e2' is not a number";
169 BEAST_EXPECT(e.
what() == expected);
180 BEAST_EXPECT(e.
what() == expected);
187 "1234567890123456789012345678901234567890123456789012345678"
188 "9012345678901234567890123456789012345678901234567890123456"
189 "78901234567890123456789012345678901234567890");
205 std::string const expected =
"'001' is not a number";
206 BEAST_EXPECT(e.
what() == expected);
216 std::string const expected =
"'000.0' is not a number";
217 BEAST_EXPECT(e.
what() == expected);
228 std::string const expected =
"'.1' is not a number";
229 BEAST_EXPECT(e.
what() == expected);
239 std::string const expected =
"'1.' is not a number";
240 BEAST_EXPECT(e.
what() == expected);
250 std::string const expected =
"'1.e3' is not a number";
251 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.