387 ledger->rawInsert(
sle(x));
392 BEAST_EXPECT(
sles(*ledger) ==
list(1, 2, 3));
393 auto e = ledger->stateMap().end();
394 auto b1 = ledger->stateMap().begin();
395 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(1)) == e);
396 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(2)) == b1);
398 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(3)) == b1);
400 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(4)) == b1);
401 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(5)) == b1);
402 b1 = ledger->stateMap().begin();
403 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(0)) == b1);
405 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(1)) == b1);
407 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(2)) == b1);
408 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(3)) == e);
413 BEAST_EXPECT(
sles(*ledger) ==
list(2, 4, 6));
414 auto e = ledger->stateMap().end();
415 auto b1 = ledger->stateMap().begin();
416 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(1)) == e);
417 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(2)) == e);
418 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(3)) == b1);
419 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(4)) == b1);
421 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(5)) == b1);
422 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(6)) == b1);
424 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(7)) == b1);
425 b1 = ledger->stateMap().begin();
426 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(1)) == b1);
428 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(2)) == b1);
429 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(3)) == b1);
432 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(4)) == b1);
433 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(5)) == b1);
434 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(6)) == e);
435 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(7)) == e);
438 setup({2, 3, 5, 6, 10, 15});
439 BEAST_EXPECT(
sles(*ledger) ==
list(2, 3, 5, 6, 10, 15));
440 auto e = ledger->stateMap().end();
441 auto b = ledger->stateMap().begin();
442 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(1)) == e);
443 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(2)) == e);
444 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(3)) == b);
446 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(4)) == b);
447 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(5)) == b);
449 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(6)) == b);
451 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(7)) == b);
452 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(8)) == b);
453 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(9)) == b);
454 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(10)) == b);
456 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(11)) == b);
457 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(12)) == b);
458 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(13)) == b);
459 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(14)) == b);
460 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(15)) == b);
462 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(16)) == b);
463 b = ledger->stateMap().begin();
464 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(0)) == b);
465 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(1)) == b);
467 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(2)) == b);
469 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(3)) == b);
470 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(4)) == b);
472 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(5)) == b);
474 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(6)) == b);
475 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(7)) == b);
476 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(8)) == b);
477 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(9)) == b);
479 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(10)) == b);
480 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(11)) == b);
481 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(12)) == b);
482 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(13)) == b);
483 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(14)) == b);
485 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(15)) == e);
486 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(16)) == e);
490 setup({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 20, 25, 30,
491 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 66, 100});
534 auto b = ledger->stateMap().begin();
535 auto e = ledger->stateMap().end();
536 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(0)) == e);
537 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(1)) == b);
538 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(5))->key() ==
uint256(4));
539 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(15))->key() ==
uint256(14));
540 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(16))->key() ==
uint256(15));
541 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(19))->key() ==
uint256(16));
542 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(20))->key() ==
uint256(16));
543 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(24))->key() ==
uint256(20));
544 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(31))->key() ==
uint256(30));
545 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(32))->key() ==
uint256(30));
546 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(40))->key() ==
uint256(39));
547 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(47))->key() ==
uint256(46));
548 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(48))->key() ==
uint256(47));
549 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(64))->key() ==
uint256(48));
551 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(90))->key() ==
uint256(66));
552 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(96))->key() ==
uint256(66));
553 BEAST_EXPECT(ledger->stateMap().lower_bound(
uint256(100))->key() ==
uint256(66));
555 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(0))->key() ==
uint256(1));
556 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(5))->key() ==
uint256(6));
557 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(15))->key() ==
uint256(16));
558 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(16))->key() ==
uint256(20));
559 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(18))->key() ==
uint256(20));
560 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(20))->key() ==
uint256(25));
561 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(31))->key() ==
uint256(32));
562 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(32))->key() ==
uint256(33));
563 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(47))->key() ==
uint256(48));
564 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(48))->key() ==
uint256(66));
565 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(53))->key() ==
uint256(66));
566 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(66))->key() ==
uint256(100));
567 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(70))->key() ==
uint256(100));
568 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(85))->key() ==
uint256(100));
569 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(98))->key() ==
uint256(100));
570 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(100)) == e);
571 BEAST_EXPECT(ledger->stateMap().upper_bound(
uint256(155)) == e);
850 auto const alice =
Account(
"alice");
851 auto const bob =
Account(
"bob");
858 auto const rdViewA3 = eA.
closed();
862 auto const rdViewA4 = eA.
closed();
872 auto const rdViewB3 = eB.closed();
874 eB.fund(
XRP(10000), alice);
876 auto const rdViewB4 = eB.closed();
880 BEAST_EXPECT(
areCompatible(*rdViewA3, *rdViewA4, jStream,
""));
881 BEAST_EXPECT(
areCompatible(*rdViewA4, *rdViewA3, jStream,
""));
882 BEAST_EXPECT(
areCompatible(*rdViewA4, *rdViewA4, jStream,
""));
883 BEAST_EXPECT(!
areCompatible(*rdViewA3, *rdViewB4, jStream,
""));
884 BEAST_EXPECT(!
areCompatible(*rdViewA4, *rdViewB3, jStream,
""));
885 BEAST_EXPECT(!
areCompatible(*rdViewA4, *rdViewB4, jStream,
""));
889 auto const& iA3 = rdViewA3->header();
890 auto const& iA4 = rdViewA4->header();
892 BEAST_EXPECT(
areCompatible(iA3.hash, iA3.seq, *rdViewA4, jStream,
""));
893 BEAST_EXPECT(
areCompatible(iA4.hash, iA4.seq, *rdViewA3, jStream,
""));
894 BEAST_EXPECT(
areCompatible(iA4.hash, iA4.seq, *rdViewA4, jStream,
""));
895 BEAST_EXPECT(!
areCompatible(iA3.hash, iA3.seq, *rdViewB4, jStream,
""));
896 BEAST_EXPECT(
areCompatible(iA4.hash, iA4.seq, *rdViewB3, jStream,
""));
897 BEAST_EXPECT(!
areCompatible(iA4.hash, iA4.seq, *rdViewB4, jStream,
""));