53 for (
auto i : {-1, 0, 1})
57 BEAST_EXPECT((i == 0) == (x == zero));
58 BEAST_EXPECT((i != 0) == (x != zero));
59 BEAST_EXPECT((i < 0) == (x < zero));
60 BEAST_EXPECT((i > 0) == (x > zero));
61 BEAST_EXPECT((i <= 0) == (x <= zero));
62 BEAST_EXPECT((i >= 0) == (x >= zero));
64 BEAST_EXPECT((0 == i) == (zero == x));
65 BEAST_EXPECT((0 != i) == (zero != x));
66 BEAST_EXPECT((0 < i) == (zero < x));
67 BEAST_EXPECT((0 > i) == (zero > x));
68 BEAST_EXPECT((0 <= i) == (zero <= x));
69 BEAST_EXPECT((0 >= i) == (zero >= x));
78 for (
auto i : {-1, 0, 1})
82 for (
auto j : {-1, 0, 1})
86 BEAST_EXPECT((i == j) == (x == y));
87 BEAST_EXPECT((i != j) == (x != y));
88 BEAST_EXPECT((i < j) == (x < y));
89 BEAST_EXPECT((i > j) == (x > y));
90 BEAST_EXPECT((i <= j) == (x <= y));
91 BEAST_EXPECT((i >= j) == (x >= y));
146 BEAST_EXPECT(test.drops() == 0);
148 test = make(beast::zero);
149 BEAST_EXPECT(test.drops() == 0);
152 BEAST_EXPECT(test.drops() == 0);
155 BEAST_EXPECT(test.drops() == 100);
158 BEAST_EXPECT(test.drops() == 100);
161 test = make(targetSame);
162 BEAST_EXPECT(test.drops() == 200);
163 BEAST_EXPECT(test == targetSame);
168 BEAST_EXPECT(test.drops() == 200);
170 BEAST_EXPECT(test.drops() == 300);
173 BEAST_EXPECT(test.drops() == 200);
175 BEAST_EXPECT(testOther);
176 BEAST_EXPECT(*testOther == 200);
179 BEAST_EXPECT(!testOther);
182 BEAST_EXPECT(!testOther);
184 test = targetSame * 2;
185 BEAST_EXPECT(test.drops() == 400);
186 test = 3 * targetSame;
187 BEAST_EXPECT(test.drops() == 600);
189 BEAST_EXPECT(test.drops() == 20);
192 BEAST_EXPECT(test.drops() == 220);
195 BEAST_EXPECT(test.drops() == 20);
198 BEAST_EXPECT(test.drops() == 100);
200 BEAST_EXPECT(test.drops() == 50);
202 BEAST_EXPECT(test.drops() == 11);
206 BEAST_EXPECT(test.drops() == -11);
207 BEAST_EXPECT(test.signum() == -1);
213 BEAST_EXPECT(test.signum() == 0);
215 BEAST_EXPECT(test.signum() == 1);
225 constexpr auto maxXRP =
227 constexpr auto minXRP =
234 BEAST_EXPECT(big ==
mulRatio(big, maxUInt32, maxUInt32,
true));
236 BEAST_EXPECT(big ==
mulRatio(big, maxUInt32, maxUInt32,
false));
242 mulRatio(big, 3, 4,
false).value() == (big.
value() / 4) * 3);
245 BEAST_EXPECT((big.
value() * 3) / 4 != (big.
value() / 4) * 3);
251 BEAST_EXPECT(big ==
mulRatio(big, maxUInt32, maxUInt32,
true));
253 BEAST_EXPECT(big ==
mulRatio(big, maxUInt32, maxUInt32,
false));
258 mulRatio(big, 3, 4,
false).value() == (big.
value() / 4) * 3);
261 BEAST_EXPECT((big.
value() * 3) / 4 != (big.
value() / 4) * 3);
268 BEAST_EXPECT(tiny ==
mulRatio(tiny, 1, maxUInt32,
true));
270 BEAST_EXPECT(beast::zero ==
mulRatio(tiny, 1, maxUInt32,
false));
272 beast::zero ==
mulRatio(tiny, maxUInt32 - 1, maxUInt32,
false));
277 BEAST_EXPECT(beast::zero ==
mulRatio(tinyNeg, 1, maxUInt32,
true));
280 mulRatio(tinyNeg, maxUInt32 - 1, maxUInt32,
true));
283 tinyNeg ==
mulRatio(tinyNeg, maxUInt32 - 1, maxUInt32,
false));
289 auto const rup =
mulRatio(
one, maxUInt32 - 1, maxUInt32,
true);
292 BEAST_EXPECT(rup.drops() - rdown.drops() == 1);
297 auto const rup =
mulRatio(big, maxUInt32 - 1, maxUInt32,
true);
299 mulRatio(big, maxUInt32 - 1, maxUInt32,
false);
300 BEAST_EXPECT(rup.drops() - rdown.drops() == 1);
306 mulRatio(negOne, maxUInt32 - 1, maxUInt32,
true);
308 mulRatio(negOne, maxUInt32 - 1, maxUInt32,
false);
309 BEAST_EXPECT(rup.drops() - rdown.drops() == 1);
328 BEAST_EXPECT(
mulRatio(bigNegative, 2, 1,
true) == minXRP);