34 for (
auto i : {-1, 0, 1})
38 BEAST_EXPECT((i == 0) == (x == zero));
39 BEAST_EXPECT((i != 0) == (x != zero));
40 BEAST_EXPECT((i < 0) == (x < zero));
41 BEAST_EXPECT((i > 0) == (x > zero));
42 BEAST_EXPECT((i <= 0) == (x <= zero));
43 BEAST_EXPECT((i >= 0) == (x >= zero));
45 BEAST_EXPECT((0 == i) == (zero == x));
46 BEAST_EXPECT((0 != i) == (zero != x));
47 BEAST_EXPECT((0 < i) == (zero < x));
48 BEAST_EXPECT((0 > i) == (zero > x));
49 BEAST_EXPECT((0 <= i) == (zero <= x));
50 BEAST_EXPECT((0 >= i) == (zero >= x));
59 for (
auto i : {-1, 0, 1})
63 for (
auto j : {-1, 0, 1})
67 BEAST_EXPECT((i == j) == (x == y));
68 BEAST_EXPECT((i != j) == (x != y));
69 BEAST_EXPECT((i < j) == (x < y));
70 BEAST_EXPECT((i > j) == (x > y));
71 BEAST_EXPECT((i <= j) == (x <= y));
72 BEAST_EXPECT((i >= j) == (x >= y));
127 BEAST_EXPECT(test.drops() == 0);
129 test = make(beast::zero);
130 BEAST_EXPECT(test.drops() == 0);
133 BEAST_EXPECT(test.drops() == 0);
136 BEAST_EXPECT(test.drops() == 100);
139 BEAST_EXPECT(test.drops() == 100);
142 test = make(targetSame);
143 BEAST_EXPECT(test.drops() == 200);
144 BEAST_EXPECT(test == targetSame);
149 BEAST_EXPECT(test.drops() == 200);
151 BEAST_EXPECT(test.drops() == 300);
154 BEAST_EXPECT(test.drops() == 200);
156 BEAST_EXPECT(testOther);
157 BEAST_EXPECT(*testOther == 200);
160 BEAST_EXPECT(!testOther);
163 BEAST_EXPECT(!testOther);
165 test = targetSame * 2;
166 BEAST_EXPECT(test.drops() == 400);
167 test = 3 * targetSame;
168 BEAST_EXPECT(test.drops() == 600);
170 BEAST_EXPECT(test.drops() == 20);
173 BEAST_EXPECT(test.drops() == 220);
176 BEAST_EXPECT(test.drops() == 20);
179 BEAST_EXPECT(test.drops() == 100);
181 BEAST_EXPECT(test.drops() == 50);
183 BEAST_EXPECT(test.drops() == 11);
187 BEAST_EXPECT(test.drops() == -11);
188 BEAST_EXPECT(test.signum() == -1);
194 BEAST_EXPECT(test.signum() == 0);
196 BEAST_EXPECT(test.signum() == 1);
206 constexpr auto maxXRP =
208 constexpr auto minXRP =
215 BEAST_EXPECT(big ==
mulRatio(big, maxUInt32, maxUInt32,
true));
217 BEAST_EXPECT(big ==
mulRatio(big, maxUInt32, maxUInt32,
false));
223 mulRatio(big, 3, 4,
false).value() == (big.
value() / 4) * 3);
226 BEAST_EXPECT((big.
value() * 3) / 4 != (big.
value() / 4) * 3);
232 BEAST_EXPECT(big ==
mulRatio(big, maxUInt32, maxUInt32,
true));
234 BEAST_EXPECT(big ==
mulRatio(big, maxUInt32, maxUInt32,
false));
239 mulRatio(big, 3, 4,
false).value() == (big.
value() / 4) * 3);
242 BEAST_EXPECT((big.
value() * 3) / 4 != (big.
value() / 4) * 3);
249 BEAST_EXPECT(tiny ==
mulRatio(tiny, 1, maxUInt32,
true));
251 BEAST_EXPECT(beast::zero ==
mulRatio(tiny, 1, maxUInt32,
false));
253 beast::zero ==
mulRatio(tiny, maxUInt32 - 1, maxUInt32,
false));
258 BEAST_EXPECT(beast::zero ==
mulRatio(tinyNeg, 1, maxUInt32,
true));
261 mulRatio(tinyNeg, maxUInt32 - 1, maxUInt32,
true));
264 tinyNeg ==
mulRatio(tinyNeg, maxUInt32 - 1, maxUInt32,
false));
270 auto const rup =
mulRatio(
one, maxUInt32 - 1, maxUInt32,
true);
273 BEAST_EXPECT(rup.drops() - rdown.drops() == 1);
278 auto const rup =
mulRatio(big, maxUInt32 - 1, maxUInt32,
true);
280 mulRatio(big, maxUInt32 - 1, maxUInt32,
false);
281 BEAST_EXPECT(rup.drops() - rdown.drops() == 1);
287 mulRatio(negOne, maxUInt32 - 1, maxUInt32,
true);
289 mulRatio(negOne, maxUInt32 - 1, maxUInt32,
false);
290 BEAST_EXPECT(rup.drops() - rdown.drops() == 1);
309 BEAST_EXPECT(
mulRatio(bigNegative, 2, 1,
true) == minXRP);