text:
@test first(evaluate5(A♣, A♡, A♢, K♠, Q♢)) == 1610 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, K♠, J♢)) == 1611 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, K♠, T♢)) == 1612 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, K♠, 9♢)) == 1613 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, K♠, 8♢)) == 1614 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, K♠, 7♢)) == 1615 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, K♠, 6♢)) == 1616 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, K♠, 5♢)) == 1617 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, K♠, 4♢)) == 1618 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, K♠, 3♢)) == 1619 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, K♠, 2♢)) == 1620 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, Q♠, J♢)) == 1621 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, Q♠, T♢)) == 1622 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, Q♠, 9♢)) == 1623 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, Q♠, 8♢)) == 1624 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, Q♠, 7♢)) == 1625 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, Q♠, 6♢)) == 1626 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, Q♠, 5♢)) == 1627 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, Q♠, 4♢)) == 1628 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, Q♠, 3♢)) == 1629 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, Q♠, 2♢)) == 1630 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, J♠, T♢)) == 1631 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, J♠, 9♢)) == 1632 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, J♠, 8♢)) == 1633 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, J♠, 7♢)) == 1634 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, J♠, 6♢)) == 1635 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, J♠, 5♢)) == 1636 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, J♠, 4♢)) == 1637 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, J♠, 3♢)) == 1638 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, J♠, 2♢)) == 1639 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, T♠, 9♢)) == 1640 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, T♠, 8♢)) == 1641 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, T♠, 7♢)) == 1642 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, T♠, 6♢)) == 1643 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, T♠, 5♢)) == 1644 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, T♠, 4♢)) == 1645 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, T♠, 3♢)) == 1646 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, T♠, 2♢)) == 1647 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 9♠, 8♢)) == 1648 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 9♠, 7♢)) == 1649 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 9♠, 6♢)) == 1650 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 9♠, 5♢)) == 1651 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 9♠, 4♢)) == 1652 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 9♠, 3♢)) == 1653 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 9♠, 2♢)) == 1654 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 8♠, 7♢)) == 1655 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 8♠, 6♢)) == 1656 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 8♠, 5♢)) == 1657 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 8♠, 4♢)) == 1658 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 8♠, 3♢)) == 1659 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 8♠, 2♢)) == 1660 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 7♠, 6♢)) == 1661 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 7♠, 5♢)) == 1662 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 7♠, 4♢)) == 1663 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 7♠, 3♢)) == 1664 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 7♠, 2♢)) == 1665 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 6♠, 5♢)) == 1666 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 6♠, 4♢)) == 1667 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 6♠, 3♢)) == 1668 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 6♠, 2♢)) == 1669 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 5♠, 4♢)) == 1670 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 5♠, 3♢)) == 1671 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 5♠, 2♢)) == 1672 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 4♠, 3♢)) == 1673 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 4♠, 2♢)) == 1674 # Three Aces
@test first(evaluate5(A♣, A♡, A♢, 3♠, 2♢)) == 1675 # Three Aces
@test first(evaluate5(K♣, K♡, K♢, A♠, Q♢)) == 1676 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, A♠, J♢)) == 1677 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, A♠, T♢)) == 1678 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, A♠, 9♢)) == 1679 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, A♠, 8♢)) == 1680 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, A♠, 7♢)) == 1681 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, A♠, 6♢)) == 1682 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, A♠, 5♢)) == 1683 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, A♠, 4♢)) == 1684 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, A♠, 3♢)) == 1685 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, A♠, 2♢)) == 1686 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, Q♠, J♢)) == 1687 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, Q♠, T♢)) == 1688 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, Q♠, 9♢)) == 1689 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, Q♠, 8♢)) == 1690 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, Q♠, 7♢)) == 1691 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, Q♠, 6♢)) == 1692 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, Q♠, 5♢)) == 1693 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, Q♠, 4♢)) == 1694 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, Q♠, 3♢)) == 1695 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, Q♠, 2♢)) == 1696 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, J♠, T♢)) == 1697 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, J♠, 9♢)) == 1698 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, J♠, 8♢)) == 1699 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, J♠, 7♢)) == 1700 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, J♠, 6♢)) == 1701 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, J♠, 5♢)) == 1702 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, J♠, 4♢)) == 1703 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, J♠, 3♢)) == 1704 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, J♠, 2♢)) == 1705 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, T♠, 9♢)) == 1706 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, T♠, 8♢)) == 1707 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, T♠, 7♢)) == 1708 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, T♠, 6♢)) == 1709 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, T♠, 5♢)) == 1710 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, T♠, 4♢)) == 1711 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, T♠, 3♢)) == 1712 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, T♠, 2♢)) == 1713 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 9♠, 8♢)) == 1714 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 9♠, 7♢)) == 1715 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 9♠, 6♢)) == 1716 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 9♠, 5♢)) == 1717 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 9♠, 4♢)) == 1718 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 9♠, 3♢)) == 1719 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 9♠, 2♢)) == 1720 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 8♠, 7♢)) == 1721 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 8♠, 6♢)) == 1722 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 8♠, 5♢)) == 1723 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 8♠, 4♢)) == 1724 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 8♠, 3♢)) == 1725 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 8♠, 2♢)) == 1726 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 7♠, 6♢)) == 1727 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 7♠, 5♢)) == 1728 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 7♠, 4♢)) == 1729 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 7♠, 3♢)) == 1730 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 7♠, 2♢)) == 1731 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 6♠, 5♢)) == 1732 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 6♠, 4♢)) == 1733 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 6♠, 3♢)) == 1734 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 6♠, 2♢)) == 1735 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 5♠, 4♢)) == 1736 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 5♠, 3♢)) == 1737 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 5♠, 2♢)) == 1738 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 4♠, 3♢)) == 1739 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 4♠, 2♢)) == 1740 # Three Kings
@test first(evaluate5(K♣, K♡, K♢, 3♠, 2♢)) == 1741 # Three Kings
@test first(evaluate5(Q♣, Q♡, Q♢, A♠, K♢)) == 1742 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, A♠, J♢)) == 1743 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, A♠, T♢)) == 1744 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, A♠, 9♢)) == 1745 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, A♠, 8♢)) == 1746 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, A♠, 7♢)) == 1747 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, A♠, 6♢)) == 1748 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, A♠, 5♢)) == 1749 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, A♠, 4♢)) == 1750 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, A♠, 3♢)) == 1751 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, A♠, 2♢)) == 1752 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, K♠, J♢)) == 1753 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, K♠, T♢)) == 1754 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, K♠, 9♢)) == 1755 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, K♠, 8♢)) == 1756 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, K♠, 7♢)) == 1757 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, K♠, 6♢)) == 1758 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, K♠, 5♢)) == 1759 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, K♠, 4♢)) == 1760 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, K♠, 3♢)) == 1761 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, K♠, 2♢)) == 1762 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, J♠, T♢)) == 1763 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, J♠, 9♢)) == 1764 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, J♠, 8♢)) == 1765 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, J♠, 7♢)) == 1766 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, J♠, 6♢)) == 1767 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, J♠, 5♢)) == 1768 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, J♠, 4♢)) == 1769 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, J♠, 3♢)) == 1770 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, J♠, 2♢)) == 1771 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, T♠, 9♢)) == 1772 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, T♠, 8♢)) == 1773 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, T♠, 7♢)) == 1774 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, T♠, 6♢)) == 1775 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, T♠, 5♢)) == 1776 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, T♠, 4♢)) == 1777 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, T♠, 3♢)) == 1778 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, T♠, 2♢)) == 1779 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 9♠, 8♢)) == 1780 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 9♠, 7♢)) == 1781 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 9♠, 6♢)) == 1782 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 9♠, 5♢)) == 1783 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 9♠, 4♢)) == 1784 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 9♠, 3♢)) == 1785 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 9♠, 2♢)) == 1786 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 8♠, 7♢)) == 1787 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 8♠, 6♢)) == 1788 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 8♠, 5♢)) == 1789 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 8♠, 4♢)) == 1790 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 8♠, 3♢)) == 1791 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 8♠, 2♢)) == 1792 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 7♠, 6♢)) == 1793 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 7♠, 5♢)) == 1794 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 7♠, 4♢)) == 1795 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 7♠, 3♢)) == 1796 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 7♠, 2♢)) == 1797 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 6♠, 5♢)) == 1798 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 6♠, 4♢)) == 1799 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 6♠, 3♢)) == 1800 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 6♠, 2♢)) == 1801 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 5♠, 4♢)) == 1802 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 5♠, 3♢)) == 1803 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 5♠, 2♢)) == 1804 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 4♠, 3♢)) == 1805 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 4♠, 2♢)) == 1806 # Three Queens
@test first(evaluate5(Q♣, Q♡, Q♢, 3♠, 2♢)) == 1807 # Three Queens
@test first(evaluate5(J♣, J♡, J♢, A♠, K♢)) == 1808 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, A♠, Q♢)) == 1809 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, A♠, T♢)) == 1810 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, A♠, 9♢)) == 1811 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, A♠, 8♢)) == 1812 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, A♠, 7♢)) == 1813 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, A♠, 6♢)) == 1814 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, A♠, 5♢)) == 1815 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, A♠, 4♢)) == 1816 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, A♠, 3♢)) == 1817 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, A♠, 2♢)) == 1818 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, K♠, Q♢)) == 1819 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, K♠, T♢)) == 1820 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, K♠, 9♢)) == 1821 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, K♠, 8♢)) == 1822 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, K♠, 7♢)) == 1823 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, K♠, 6♢)) == 1824 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, K♠, 5♢)) == 1825 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, K♠, 4♢)) == 1826 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, K♠, 3♢)) == 1827 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, K♠, 2♢)) == 1828 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, Q♠, T♢)) == 1829 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, Q♠, 9♢)) == 1830 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, Q♠, 8♢)) == 1831 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, Q♠, 7♢)) == 1832 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, Q♠, 6♢)) == 1833 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, Q♠, 5♢)) == 1834 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, Q♠, 4♢)) == 1835 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, Q♠, 3♢)) == 1836 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, Q♠, 2♢)) == 1837 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, T♠, 9♢)) == 1838 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, T♠, 8♢)) == 1839 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, T♠, 7♢)) == 1840 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, T♠, 6♢)) == 1841 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, T♠, 5♢)) == 1842 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, T♠, 4♢)) == 1843 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, T♠, 3♢)) == 1844 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, T♠, 2♢)) == 1845 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 9♠, 8♢)) == 1846 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 9♠, 7♢)) == 1847 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 9♠, 6♢)) == 1848 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 9♠, 5♢)) == 1849 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 9♠, 4♢)) == 1850 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 9♠, 3♢)) == 1851 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 9♠, 2♢)) == 1852 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 8♠, 7♢)) == 1853 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 8♠, 6♢)) == 1854 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 8♠, 5♢)) == 1855 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 8♠, 4♢)) == 1856 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 8♠, 3♢)) == 1857 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 8♠, 2♢)) == 1858 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 7♠, 6♢)) == 1859 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 7♠, 5♢)) == 1860 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 7♠, 4♢)) == 1861 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 7♠, 3♢)) == 1862 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 7♠, 2♢)) == 1863 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 6♠, 5♢)) == 1864 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 6♠, 4♢)) == 1865 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 6♠, 3♢)) == 1866 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 6♠, 2♢)) == 1867 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 5♠, 4♢)) == 1868 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 5♠, 3♢)) == 1869 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 5♠, 2♢)) == 1870 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 4♠, 3♢)) == 1871 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 4♠, 2♢)) == 1872 # Three Jacks
@test first(evaluate5(J♣, J♡, J♢, 3♠, 2♢)) == 1873 # Three Jacks
@test first(evaluate5(T♣, T♡, T♢, A♠, K♢)) == 1874 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, A♠, Q♢)) == 1875 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, A♠, J♢)) == 1876 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, A♠, 9♢)) == 1877 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, A♠, 8♢)) == 1878 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, A♠, 7♢)) == 1879 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, A♠, 6♢)) == 1880 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, A♠, 5♢)) == 1881 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, A♠, 4♢)) == 1882 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, A♠, 3♢)) == 1883 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, A♠, 2♢)) == 1884 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, K♠, Q♢)) == 1885 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, K♠, J♢)) == 1886 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, K♠, 9♢)) == 1887 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, K♠, 8♢)) == 1888 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, K♠, 7♢)) == 1889 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, K♠, 6♢)) == 1890 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, K♠, 5♢)) == 1891 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, K♠, 4♢)) == 1892 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, K♠, 3♢)) == 1893 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, K♠, 2♢)) == 1894 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, Q♠, J♢)) == 1895 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, Q♠, 9♢)) == 1896 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, Q♠, 8♢)) == 1897 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, Q♠, 7♢)) == 1898 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, Q♠, 6♢)) == 1899 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, Q♠, 5♢)) == 1900 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, Q♠, 4♢)) == 1901 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, Q♠, 3♢)) == 1902 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, Q♠, 2♢)) == 1903 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, J♠, 9♢)) == 1904 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, J♠, 8♢)) == 1905 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, J♠, 7♢)) == 1906 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, J♠, 6♢)) == 1907 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, J♠, 5♢)) == 1908 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, J♠, 4♢)) == 1909 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, J♠, 3♢)) == 1910 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, J♠, 2♢)) == 1911 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 9♠, 8♢)) == 1912 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 9♠, 7♢)) == 1913 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 9♠, 6♢)) == 1914 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 9♠, 5♢)) == 1915 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 9♠, 4♢)) == 1916 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 9♠, 3♢)) == 1917 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 9♠, 2♢)) == 1918 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 8♠, 7♢)) == 1919 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 8♠, 6♢)) == 1920 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 8♠, 5♢)) == 1921 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 8♠, 4♢)) == 1922 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 8♠, 3♢)) == 1923 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 8♠, 2♢)) == 1924 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 7♠, 6♢)) == 1925 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 7♠, 5♢)) == 1926 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 7♠, 4♢)) == 1927 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 7♠, 3♢)) == 1928 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 7♠, 2♢)) == 1929 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 6♠, 5♢)) == 1930 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 6♠, 4♢)) == 1931 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 6♠, 3♢)) == 1932 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 6♠, 2♢)) == 1933 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 5♠, 4♢)) == 1934 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 5♠, 3♢)) == 1935 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 5♠, 2♢)) == 1936 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 4♠, 3♢)) == 1937 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 4♠, 2♢)) == 1938 # Three Tens
@test first(evaluate5(T♣, T♡, T♢, 3♠, 2♢)) == 1939 # Three Tens
@test first(evaluate5(9♣, 9♡, 9♢, A♠, K♢)) == 1940 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, A♠, Q♢)) == 1941 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, A♠, J♢)) == 1942 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, A♠, T♢)) == 1943 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, A♠, 8♢)) == 1944 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, A♠, 7♢)) == 1945 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, A♠, 6♢)) == 1946 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, A♠, 5♢)) == 1947 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, A♠, 4♢)) == 1948 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, A♠, 3♢)) == 1949 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, A♠, 2♢)) == 1950 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, K♠, Q♢)) == 1951 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, K♠, J♢)) == 1952 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, K♠, T♢)) == 1953 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, K♠, 8♢)) == 1954 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, K♠, 7♢)) == 1955 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, K♠, 6♢)) == 1956 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, K♠, 5♢)) == 1957 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, K♠, 4♢)) == 1958 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, K♠, 3♢)) == 1959 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, K♠, 2♢)) == 1960 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, Q♠, J♢)) == 1961 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, Q♠, T♢)) == 1962 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, Q♠, 8♢)) == 1963 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, Q♠, 7♢)) == 1964 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, Q♠, 6♢)) == 1965 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, Q♠, 5♢)) == 1966 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, Q♠, 4♢)) == 1967 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, Q♠, 3♢)) == 1968 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, Q♠, 2♢)) == 1969 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, J♠, T♢)) == 1970 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, J♠, 8♢)) == 1971 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, J♠, 7♢)) == 1972 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, J♠, 6♢)) == 1973 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, J♠, 5♢)) == 1974 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, J♠, 4♢)) == 1975 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, J♠, 3♢)) == 1976 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, J♠, 2♢)) == 1977 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, T♠, 8♢)) == 1978 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, T♠, 7♢)) == 1979 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, T♠, 6♢)) == 1980 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, T♠, 5♢)) == 1981 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, T♠, 4♢)) == 1982 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, T♠, 3♢)) == 1983 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, T♠, 2♢)) == 1984 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 8♠, 7♢)) == 1985 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 8♠, 6♢)) == 1986 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 8♠, 5♢)) == 1987 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 8♠, 4♢)) == 1988 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 8♠, 3♢)) == 1989 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 8♠, 2♢)) == 1990 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 7♠, 6♢)) == 1991 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 7♠, 5♢)) == 1992 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 7♠, 4♢)) == 1993 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 7♠, 3♢)) == 1994 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 7♠, 2♢)) == 1995 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 6♠, 5♢)) == 1996 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 6♠, 4♢)) == 1997 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 6♠, 3♢)) == 1998 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 6♠, 2♢)) == 1999 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 5♠, 4♢)) == 2000 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 5♠, 3♢)) == 2001 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 5♠, 2♢)) == 2002 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 4♠, 3♢)) == 2003 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 4♠, 2♢)) == 2004 # Three Nines
@test first(evaluate5(9♣, 9♡, 9♢, 3♠, 2♢)) == 2005 # Three Nines
@test first(evaluate5(8♣, 8♡, 8♢, A♠, K♢)) == 2006 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, A♠, Q♢)) == 2007 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, A♠, J♢)) == 2008 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, A♠, T♢)) == 2009 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, A♠, 9♢)) == 2010 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, A♠, 7♢)) == 2011 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, A♠, 6♢)) == 2012 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, A♠, 5♢)) == 2013 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, A♠, 4♢)) == 2014 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, A♠, 3♢)) == 2015 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, A♠, 2♢)) == 2016 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, K♠, Q♢)) == 2017 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, K♠, J♢)) == 2018 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, K♠, T♢)) == 2019 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, K♠, 9♢)) == 2020 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, K♠, 7♢)) == 2021 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, K♠, 6♢)) == 2022 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, K♠, 5♢)) == 2023 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, K♠, 4♢)) == 2024 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, K♠, 3♢)) == 2025 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, K♠, 2♢)) == 2026 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, Q♠, J♢)) == 2027 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, Q♠, T♢)) == 2028 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, Q♠, 9♢)) == 2029 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, Q♠, 7♢)) == 2030 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, Q♠, 6♢)) == 2031 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, Q♠, 5♢)) == 2032 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, Q♠, 4♢)) == 2033 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, Q♠, 3♢)) == 2034 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, Q♠, 2♢)) == 2035 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, J♠, T♢)) == 2036 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, J♠, 9♢)) == 2037 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, J♠, 7♢)) == 2038 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, J♠, 6♢)) == 2039 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, J♠, 5♢)) == 2040 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, J♠, 4♢)) == 2041 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, J♠, 3♢)) == 2042 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, J♠, 2♢)) == 2043 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, T♠, 9♢)) == 2044 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, T♠, 7♢)) == 2045 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, T♠, 6♢)) == 2046 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, T♠, 5♢)) == 2047 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, T♠, 4♢)) == 2048 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, T♠, 3♢)) == 2049 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, T♠, 2♢)) == 2050 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 9♠, 7♢)) == 2051 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 9♠, 6♢)) == 2052 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 9♠, 5♢)) == 2053 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 9♠, 4♢)) == 2054 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 9♠, 3♢)) == 2055 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 9♠, 2♢)) == 2056 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 7♠, 6♢)) == 2057 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 7♠, 5♢)) == 2058 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 7♠, 4♢)) == 2059 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 7♠, 3♢)) == 2060 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 7♠, 2♢)) == 2061 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 6♠, 5♢)) == 2062 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 6♠, 4♢)) == 2063 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 6♠, 3♢)) == 2064 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 6♠, 2♢)) == 2065 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 5♠, 4♢)) == 2066 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 5♠, 3♢)) == 2067 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 5♠, 2♢)) == 2068 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 4♠, 3♢)) == 2069 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 4♠, 2♢)) == 2070 # Three Eights
@test first(evaluate5(8♣, 8♡, 8♢, 3♠, 2♢)) == 2071 # Three Eights
@test first(evaluate5(7♣, 7♡, 7♢, A♠, K♢)) == 2072 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, A♠, Q♢)) == 2073 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, A♠, J♢)) == 2074 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, A♠, T♢)) == 2075 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, A♠, 9♢)) == 2076 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, A♠, 8♢)) == 2077 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, A♠, 6♢)) == 2078 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, A♠, 5♢)) == 2079 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, A♠, 4♢)) == 2080 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, A♠, 3♢)) == 2081 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, A♠, 2♢)) == 2082 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, K♠, Q♢)) == 2083 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, K♠, J♢)) == 2084 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, K♠, T♢)) == 2085 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, K♠, 9♢)) == 2086 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, K♠, 8♢)) == 2087 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, K♠, 6♢)) == 2088 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, K♠, 5♢)) == 2089 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, K♠, 4♢)) == 2090 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, K♠, 3♢)) == 2091 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, K♠, 2♢)) == 2092 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, Q♠, J♢)) == 2093 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, Q♠, T♢)) == 2094 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, Q♠, 9♢)) == 2095 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, Q♠, 8♢)) == 2096 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, Q♠, 6♢)) == 2097 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, Q♠, 5♢)) == 2098 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, Q♠, 4♢)) == 2099 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, Q♠, 3♢)) == 2100 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, Q♠, 2♢)) == 2101 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, J♠, T♢)) == 2102 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, J♠, 9♢)) == 2103 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, J♠, 8♢)) == 2104 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, J♠, 6♢)) == 2105 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, J♠, 5♢)) == 2106 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, J♠, 4♢)) == 2107 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, J♠, 3♢)) == 2108 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, J♠, 2♢)) == 2109 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, T♠, 9♢)) == 2110 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, T♠, 8♢)) == 2111 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, T♠, 6♢)) == 2112 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, T♠, 5♢)) == 2113 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, T♠, 4♢)) == 2114 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, T♠, 3♢)) == 2115 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, T♠, 2♢)) == 2116 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 9♠, 8♢)) == 2117 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 9♠, 6♢)) == 2118 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 9♠, 5♢)) == 2119 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 9♠, 4♢)) == 2120 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 9♠, 3♢)) == 2121 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 9♠, 2♢)) == 2122 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 8♠, 6♢)) == 2123 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 8♠, 5♢)) == 2124 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 8♠, 4♢)) == 2125 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 8♠, 3♢)) == 2126 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 8♠, 2♢)) == 2127 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 6♠, 5♢)) == 2128 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 6♠, 4♢)) == 2129 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 6♠, 3♢)) == 2130 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 6♠, 2♢)) == 2131 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 5♠, 4♢)) == 2132 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 5♠, 3♢)) == 2133 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 5♠, 2♢)) == 2134 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 4♠, 3♢)) == 2135 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 4♠, 2♢)) == 2136 # Three Sevens
@test first(evaluate5(7♣, 7♡, 7♢, 3♠, 2♢)) == 2137 # Three Sevens
@test first(evaluate5(6♣, 6♡, 6♢, A♠, K♢)) == 2138 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, A♠, Q♢)) == 2139 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, A♠, J♢)) == 2140 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, A♠, T♢)) == 2141 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, A♠, 9♢)) == 2142 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, A♠, 8♢)) == 2143 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, A♠, 7♢)) == 2144 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, A♠, 5♢)) == 2145 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, A♠, 4♢)) == 2146 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, A♠, 3♢)) == 2147 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, A♠, 2♢)) == 2148 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, K♠, Q♢)) == 2149 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, K♠, J♢)) == 2150 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, K♠, T♢)) == 2151 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, K♠, 9♢)) == 2152 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, K♠, 8♢)) == 2153 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, K♠, 7♢)) == 2154 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, K♠, 5♢)) == 2155 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, K♠, 4♢)) == 2156 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, K♠, 3♢)) == 2157 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, K♠, 2♢)) == 2158 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, Q♠, J♢)) == 2159 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, Q♠, T♢)) == 2160 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, Q♠, 9♢)) == 2161 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, Q♠, 8♢)) == 2162 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, Q♠, 7♢)) == 2163 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, Q♠, 5♢)) == 2164 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, Q♠, 4♢)) == 2165 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, Q♠, 3♢)) == 2166 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, Q♠, 2♢)) == 2167 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, J♠, T♢)) == 2168 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, J♠, 9♢)) == 2169 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, J♠, 8♢)) == 2170 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, J♠, 7♢)) == 2171 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, J♠, 5♢)) == 2172 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, J♠, 4♢)) == 2173 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, J♠, 3♢)) == 2174 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, J♠, 2♢)) == 2175 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, T♠, 9♢)) == 2176 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, T♠, 8♢)) == 2177 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, T♠, 7♢)) == 2178 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, T♠, 5♢)) == 2179 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, T♠, 4♢)) == 2180 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, T♠, 3♢)) == 2181 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, T♠, 2♢)) == 2182 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 9♠, 8♢)) == 2183 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 9♠, 7♢)) == 2184 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 9♠, 5♢)) == 2185 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 9♠, 4♢)) == 2186 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 9♠, 3♢)) == 2187 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 9♠, 2♢)) == 2188 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 8♠, 7♢)) == 2189 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 8♠, 5♢)) == 2190 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 8♠, 4♢)) == 2191 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 8♠, 3♢)) == 2192 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 8♠, 2♢)) == 2193 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 7♠, 5♢)) == 2194 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 7♠, 4♢)) == 2195 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 7♠, 3♢)) == 2196 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 7♠, 2♢)) == 2197 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 5♠, 4♢)) == 2198 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 5♠, 3♢)) == 2199 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 5♠, 2♢)) == 2200 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 4♠, 3♢)) == 2201 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 4♠, 2♢)) == 2202 # Three Sixes
@test first(evaluate5(6♣, 6♡, 6♢, 3♠, 2♢)) == 2203 # Three Sixes
@test first(evaluate5(5♣, 5♡, 5♢, A♠, K♢)) == 2204 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, A♠, Q♢)) == 2205 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, A♠, J♢)) == 2206 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, A♠, T♢)) == 2207 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, A♠, 9♢)) == 2208 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, A♠, 8♢)) == 2209 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, A♠, 7♢)) == 2210 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, A♠, 6♢)) == 2211 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, A♠, 4♢)) == 2212 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, A♠, 3♢)) == 2213 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, A♠, 2♢)) == 2214 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, K♠, Q♢)) == 2215 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, K♠, J♢)) == 2216 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, K♠, T♢)) == 2217 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, K♠, 9♢)) == 2218 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, K♠, 8♢)) == 2219 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, K♠, 7♢)) == 2220 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, K♠, 6♢)) == 2221 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, K♠, 4♢)) == 2222 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, K♠, 3♢)) == 2223 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, K♠, 2♢)) == 2224 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, Q♠, J♢)) == 2225 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, Q♠, T♢)) == 2226 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, Q♠, 9♢)) == 2227 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, Q♠, 8♢)) == 2228 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, Q♠, 7♢)) == 2229 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, Q♠, 6♢)) == 2230 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, Q♠, 4♢)) == 2231 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, Q♠, 3♢)) == 2232 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, Q♠, 2♢)) == 2233 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, J♠, T♢)) == 2234 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, J♠, 9♢)) == 2235 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, J♠, 8♢)) == 2236 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, J♠, 7♢)) == 2237 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, J♠, 6♢)) == 2238 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, J♠, 4♢)) == 2239 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, J♠, 3♢)) == 2240 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, J♠, 2♢)) == 2241 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, T♠, 9♢)) == 2242 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, T♠, 8♢)) == 2243 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, T♠, 7♢)) == 2244 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, T♠, 6♢)) == 2245 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, T♠, 4♢)) == 2246 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, T♠, 3♢)) == 2247 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, T♠, 2♢)) == 2248 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 9♠, 8♢)) == 2249 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 9♠, 7♢)) == 2250 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 9♠, 6♢)) == 2251 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 9♠, 4♢)) == 2252 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 9♠, 3♢)) == 2253 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 9♠, 2♢)) == 2254 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 8♠, 7♢)) == 2255 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 8♠, 6♢)) == 2256 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 8♠, 4♢)) == 2257 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 8♠, 3♢)) == 2258 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 8♠, 2♢)) == 2259 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 7♠, 6♢)) == 2260 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 7♠, 4♢)) == 2261 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 7♠, 3♢)) == 2262 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 7♠, 2♢)) == 2263 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 6♠, 4♢)) == 2264 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 6♠, 3♢)) == 2265 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 6♠, 2♢)) == 2266 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 4♠, 3♢)) == 2267 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 4♠, 2♢)) == 2268 # Three Fives
@test first(evaluate5(5♣, 5♡, 5♢, 3♠, 2♢)) == 2269 # Three Fives
@test first(evaluate5(4♣, 4♡, 4♢, A♠, K♢)) == 2270 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, A♠, Q♢)) == 2271 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, A♠, J♢)) == 2272 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, A♠, T♢)) == 2273 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, A♠, 9♢)) == 2274 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, A♠, 8♢)) == 2275 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, A♠, 7♢)) == 2276 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, A♠, 6♢)) == 2277 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, A♠, 5♢)) == 2278 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, A♠, 3♢)) == 2279 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, A♠, 2♢)) == 2280 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, K♠, Q♢)) == 2281 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, K♠, J♢)) == 2282 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, K♠, T♢)) == 2283 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, K♠, 9♢)) == 2284 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, K♠, 8♢)) == 2285 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, K♠, 7♢)) == 2286 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, K♠, 6♢)) == 2287 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, K♠, 5♢)) == 2288 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, K♠, 3♢)) == 2289 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, K♠, 2♢)) == 2290 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, Q♠, J♢)) == 2291 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, Q♠, T♢)) == 2292 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, Q♠, 9♢)) == 2293 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, Q♠, 8♢)) == 2294 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, Q♠, 7♢)) == 2295 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, Q♠, 6♢)) == 2296 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, Q♠, 5♢)) == 2297 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, Q♠, 3♢)) == 2298 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, Q♠, 2♢)) == 2299 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, J♠, T♢)) == 2300 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, J♠, 9♢)) == 2301 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, J♠, 8♢)) == 2302 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, J♠, 7♢)) == 2303 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, J♠, 6♢)) == 2304 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, J♠, 5♢)) == 2305 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, J♠, 3♢)) == 2306 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, J♠, 2♢)) == 2307 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, T♠, 9♢)) == 2308 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, T♠, 8♢)) == 2309 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, T♠, 7♢)) == 2310 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, T♠, 6♢)) == 2311 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, T♠, 5♢)) == 2312 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, T♠, 3♢)) == 2313 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, T♠, 2♢)) == 2314 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 9♠, 8♢)) == 2315 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 9♠, 7♢)) == 2316 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 9♠, 6♢)) == 2317 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 9♠, 5♢)) == 2318 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 9♠, 3♢)) == 2319 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 9♠, 2♢)) == 2320 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 8♠, 7♢)) == 2321 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 8♠, 6♢)) == 2322 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 8♠, 5♢)) == 2323 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 8♠, 3♢)) == 2324 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 8♠, 2♢)) == 2325 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 7♠, 6♢)) == 2326 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 7♠, 5♢)) == 2327 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 7♠, 3♢)) == 2328 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 7♠, 2♢)) == 2329 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 6♠, 5♢)) == 2330 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 6♠, 3♢)) == 2331 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 6♠, 2♢)) == 2332 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 5♠, 3♢)) == 2333 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 5♠, 2♢)) == 2334 # Three Fours
@test first(evaluate5(4♣, 4♡, 4♢, 3♠, 2♢)) == 2335 # Three Fours
@test first(evaluate5(3♣, 3♡, 3♢, A♠, K♢)) == 2336 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, A♠, Q♢)) == 2337 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, A♠, J♢)) == 2338 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, A♠, T♢)) == 2339 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, A♠, 9♢)) == 2340 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, A♠, 8♢)) == 2341 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, A♠, 7♢)) == 2342 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, A♠, 6♢)) == 2343 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, A♠, 5♢)) == 2344 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, A♠, 4♢)) == 2345 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, A♠, 2♢)) == 2346 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, K♠, Q♢)) == 2347 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, K♠, J♢)) == 2348 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, K♠, T♢)) == 2349 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, K♠, 9♢)) == 2350 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, K♠, 8♢)) == 2351 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, K♠, 7♢)) == 2352 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, K♠, 6♢)) == 2353 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, K♠, 5♢)) == 2354 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, K♠, 4♢)) == 2355 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, K♠, 2♢)) == 2356 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, Q♠, J♢)) == 2357 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, Q♠, T♢)) == 2358 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, Q♠, 9♢)) == 2359 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, Q♠, 8♢)) == 2360 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, Q♠, 7♢)) == 2361 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, Q♠, 6♢)) == 2362 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, Q♠, 5♢)) == 2363 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, Q♠, 4♢)) == 2364 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, Q♠, 2♢)) == 2365 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, J♠, T♢)) == 2366 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, J♠, 9♢)) == 2367 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, J♠, 8♢)) == 2368 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, J♠, 7♢)) == 2369 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, J♠, 6♢)) == 2370 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, J♠, 5♢)) == 2371 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, J♠, 4♢)) == 2372 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, J♠, 2♢)) == 2373 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, T♠, 9♢)) == 2374 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, T♠, 8♢)) == 2375 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, T♠, 7♢)) == 2376 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, T♠, 6♢)) == 2377 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, T♠, 5♢)) == 2378 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, T♠, 4♢)) == 2379 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, T♠, 2♢)) == 2380 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 9♠, 8♢)) == 2381 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 9♠, 7♢)) == 2382 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 9♠, 6♢)) == 2383 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 9♠, 5♢)) == 2384 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 9♠, 4♢)) == 2385 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 9♠, 2♢)) == 2386 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 8♠, 7♢)) == 2387 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 8♠, 6♢)) == 2388 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 8♠, 5♢)) == 2389 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 8♠, 4♢)) == 2390 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 8♠, 2♢)) == 2391 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 7♠, 6♢)) == 2392 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 7♠, 5♢)) == 2393 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 7♠, 4♢)) == 2394 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 7♠, 2♢)) == 2395 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 6♠, 5♢)) == 2396 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 6♠, 4♢)) == 2397 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 6♠, 2♢)) == 2398 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 5♠, 4♢)) == 2399 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 5♠, 2♢)) == 2400 # Three Treys
@test first(evaluate5(3♣, 3♡, 3♢, 4♠, 2♢)) == 2401 # Three Treys
@test first(evaluate5(2♣, 2♡, 2♢, A♠, K♢)) == 2402 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, A♠, Q♢)) == 2403 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, A♠, J♢)) == 2404 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, A♠, T♢)) == 2405 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, A♠, 9♢)) == 2406 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, A♠, 8♢)) == 2407 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, A♠, 7♢)) == 2408 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, A♠, 6♢)) == 2409 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, A♠, 5♢)) == 2410 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, A♠, 4♢)) == 2411 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, A♠, 3♢)) == 2412 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, K♠, Q♢)) == 2413 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, K♠, J♢)) == 2414 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, K♠, T♢)) == 2415 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, K♠, 9♢)) == 2416 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, K♠, 8♢)) == 2417 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, K♠, 7♢)) == 2418 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, K♠, 6♢)) == 2419 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, K♠, 5♢)) == 2420 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, K♠, 4♢)) == 2421 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, K♠, 3♢)) == 2422 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, Q♠, J♢)) == 2423 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, Q♠, T♢)) == 2424 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, Q♠, 9♢)) == 2425 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, Q♠, 8♢)) == 2426 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, Q♠, 7♢)) == 2427 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, Q♠, 6♢)) == 2428 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, Q♠, 5♢)) == 2429 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, Q♠, 4♢)) == 2430 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, Q♠, 3♢)) == 2431 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, J♠, T♢)) == 2432 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, J♠, 9♢)) == 2433 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, J♠, 8♢)) == 2434 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, J♠, 7♢)) == 2435 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, J♠, 6♢)) == 2436 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, J♠, 5♢)) == 2437 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, J♠, 4♢)) == 2438 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, J♠, 3♢)) == 2439 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, T♠, 9♢)) == 2440 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, T♠, 8♢)) == 2441 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, T♠, 7♢)) == 2442 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, T♠, 6♢)) == 2443 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, T♠, 5♢)) == 2444 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, T♠, 4♢)) == 2445 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, T♠, 3♢)) == 2446 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 9♠, 8♢)) == 2447 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 9♠, 7♢)) == 2448 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 9♠, 6♢)) == 2449 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 9♠, 5♢)) == 2450 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 9♠, 4♢)) == 2451 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 9♠, 3♢)) == 2452 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 8♠, 7♢)) == 2453 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 8♠, 6♢)) == 2454 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 8♠, 5♢)) == 2455 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 8♠, 4♢)) == 2456 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 8♠, 3♢)) == 2457 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 7♠, 6♢)) == 2458 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 7♠, 5♢)) == 2459 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 7♠, 4♢)) == 2460 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 7♠, 3♢)) == 2461 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 6♠, 5♢)) == 2462 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 6♠, 4♢)) == 2463 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 6♠, 3♢)) == 2464 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 5♠, 4♢)) == 2465 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 5♠, 3♢)) == 2466 # Three Deuces
@test first(evaluate5(2♣, 2♡, 2♢, 4♠, 3♢)) == 2467 # Three Deuces


text:
using GeometricIntegrators

set_config(:tab_compensated_summation, false)

const out_dir = "../../docs/src/integrators/projection_methods/guiding_center_4d/"
const run_id  = "fast_barely_trapped_vprk_quad"

include("guiding_center_4d_fast_barely_trapped.jl")
include("../guiding_center_4d_vprk_quad.jl")

ext: jl


text:
function _density(data; xlims = (-Inf, Inf), trim = false, kwargs...)
    k = kde(data; kwargs...)
    x, y = k.x, k.density
    xmin, xmax = xlims
    xmin = max(xmin, minimum(data))
    xmax = min(xmax, maximum(data))
    if trim
        for i in eachindex(x, y)
            xmin ≤ x[i] ≤ xmax || (y[i] = NaN)
        end
    end
    return visual(:Lines) * mapping(x, y)
end

function _density(datax, datay; xlims = (-Inf, Inf), ylims = (-Inf, Inf), trim = false, kwargs...)
    k = kde((datax, datay); kwargs...)
    x, y, z = k.x, k.y, k.density
    xmin, xmax = xlims
    xmin = max(xmin, minimum(datax))
    xmax = min(xmax, maximum(datax))
    ymin, ymax = ylims
    ymin = max(ymin, minimum(datay))
    ymax = min(ymax, maximum(datay))
    if trim
        for i in eachindex(x, y)
            xmin ≤ x[i] ≤ xmax && ymin ≤ y[i] ≤ ymax || (z[i] = NaN)
        end
    end
    return visual(:Heatmap) * mapping(x, y, z)
end

"""
    density(data...; trim = false, boundary, npoints, kernel, bandwidth)

Fit a kernel density estimation of `data`. Only 1D and 2D are supported so far.
The optional keyword arguments are
* `boundary`: the lower and upper limits of the kde as a tuple. Due to the
  fourier transforms used internally, there should be sufficient spacing to
  prevent wrap-around at the boundaries.
* `npoints`: the number of interpolation points to use. The function uses
  fast Fourier transforms (FFTs) internally, so for optimal efficiency this
  should be a power of 2 (default = 2048).
* `kernel`: the distributional family from
  [Distributions.jl](https://github.com/JuliaStats/Distributions.jl) to use as
  the kernel (default = `Normal`). To add your own kernel, extend the internal
  `kernel_dist` function.
* `bandwidth`: the bandwidth of the kernel. Default is to use Silverman's rule.
"""
const density = Analysis(_density)


text:
"""
    Branch

    A branch connecting two AbstractNodes of a phylogenetic tree
"""
mutable struct Branch{RT, NL} <: AbstractBranch{RT, NL}
    name::Int
    source::NL
    destination::NL
    length::Union{Float64, Missing}

    function Branch{RT}(name::Int, source::NL, destination::NL,
                        len::Union{Float64, Missing} = missing) where {RT, NL}
        ismissing(len) || len >= 0.0 ||
            error("Branch length must be positive or missing (no recorded length), not $len")
        new{RT, NL}(name, source, destination, len)
    end
end

import Phylo.API: _preferbranchobjects
_preferbranchobjects(::Type{<:Branch}) = true

import Phylo.API: _src
_src(::AbstractTree, branch::Branch) = branch.source
import Phylo.API: _dst
_dst(::AbstractTree, branch::Branch) = branch.destination
import Phylo.API: _getlength
_getlength(::AbstractTree, branch::Branch) = branch.length
import Phylo.API: _getbranchname
_getbranchname(::AbstractTree, branch::Branch) = branch.name
import Phylo.API: _getbranchdata
_getbranchdata(::AbstractTree, ::Branch) = nothing

function checkbranch(id::Int, branch::Branch{<: Rooted}, tree::AbstractTree)
    return id > 0 &&
        hasbranch(tree, id) &&
        src(tree, branch) != dst(tree, branch) &&
        hasnode(tree, src(tree, branch)) &&
        hasnode(tree, dst(tree, branch)) &&
        indegree(tree, getnode(tree, dst(tree, branch))) > 0 &&
        outdegree(tree, src(tree, branch)) > 0 &&
        getbranch(tree, getinbound(tree, dst(tree, branch))) === branch
end


text:
using Pkg

Pkg.activate(".")
Pkg.instantiate()

push!(LOAD_PATH,"../src/")

using Documenter, DocumenterMarkdown, FastRunningMedian

makedocs(
    format=Markdown(),
    modules=[FastRunningMedian]
    )

cp("build/README.md", "../README.md", force=true)

max_stars_repo_name: Firionus/FastRunningMedian

max_issues_repo_name: Firionus/FastRunningMedian


text:
using Main.JuliaPkgsList: getName, getRepo, getStarCount

@testset "JuliaPkgsList.jl :: pkgs API" begin
    @info "Downloading packages info..."
    # URL is still valid and produces a JSON file
    download(JuliaPkgsList.PKGS_INFO_URL, PKGS_INFO_FILE)
    @test isfile(PKGS_INFO_FILE)

    @info "Checking the format..."
    # JSON object with a single entry is expected
    data = JSON.parsefile(PKGS_INFO_FILE)
    @test isa(data, Dict)
    @test length(data) == 1

    # The format is still the same: PKGS_KEY => [Package]
    @test haskey(data, JuliaPkgsList.PKGS_KEY)
    pkgs = data[JuliaPkgsList.PKGS_KEY]
    @test isa(pkgs, Vector)
    @test length(pkgs) > 1

    # The format of a single package info is the same
    pkg1 = pkgs[1]
    @test haskey(pkg1, JuliaPkgsList.NAME_KEY)
    @test isa(pkg1[JuliaPkgsList.NAME_KEY], String)
    @test haskey(pkg1, JuliaPkgsList.METADATA_KEY)
    md1 = pkg1[JuliaPkgsList.METADATA_KEY]
    @test isa(md1, Dict)
    @test haskey(md1, JuliaPkgsList.REPO_KEY)
    @test isa(md1[JuliaPkgsList.REPO_KEY], String)
    @test haskey(md1, JuliaPkgsList.VERSIONS_KEY)
    @test isa(md1[JuliaPkgsList.VERSIONS_KEY], Vector)

    # Julia package itself is in the list
    jlInd = findfirst(pkg -> getRepo(pkg) == JULIA_REPO, pkgs)
    @test isa(jlInd, Int) && jlInd > 0
    @test getName(pkgs[jlInd]) == JULIA_NAME

    # All packages have necessary information
    @test getSortedPkgs(pkgs)[1] == JULIA_REPO

    # `rm` was failing on Windows x64 (Jan 2020, Julia 1.5.3)
    tryrm(PKGS_INFO_FILE)
end


text:
n = 30
m = 20
p = 5

@testset "Testing $(MLK.samplematrix)" begin
    X = Array{Int64}(undef, n, m)
    r = 0.15
    @test length(MLK.samplematrix(Val(:row), X, r)) == max(Int64(trunc(n*r)),1)
    @test length(MLK.samplematrix(Val(:col), X, r)) == max(Int64(trunc(m*r)),1)
end

@testset "Testing $(MLK.nystrom_sample)" begin
    for T in FloatingPointTypes
        F = convert(Kernel{T}, GaussianKernel())
        local X  = rand(T, n+5, p)
        Xs = X[1:n, :]

        for orientation in (Val(:row), Val(:col))
            X_tst, Xs_tst = orientation == Val(:row) ? (X, Xs) : (permutedims(X), permutedims(Xs))

            K_tst = kernelmatrix(orientation, F, Xs_tst, X_tst)
            Ks_tst = kernelmatrix(orientation, F, Xs_tst, Xs_tst)

            K_tmp, Ks_tmp = MLK.nystrom_sample(orientation, F, X_tst, [i for i = 1:n])

            @test isapprox(K_tmp,  K_tst)
            @test isapprox(Ks_tmp, Ks_tst)
        end
    end
end

@testset "Testing $(MLK.nystrom_pinv!)" begin
    for T in FloatingPointTypes
        local X = rand(T, n, p)
        XtX = permutedims(X) * X

        @test isapprox(LinearAlgebra.pinv(XtX), MLK.nystrom_pinv!(copy(permutedims(X) * X)))
    end
end

@testset "Testing $(MLK.nystrom)" begin
    for T in FloatingPointTypes
        F = convert(Kernel{T}, GaussianKernel())
        local X = rand(T, n+3, p)
        S = [i for i = 1:n]

        for orientation in (Val(:row), Val(:col))
            X_tst, Xs_tst = orientation == Val(:row) ? (X, X[S,:]) : (permutedims(X), permutedims(X[S,:]))

            C_tst = permutedims(kernelmatrix(orientation, F, X_tst, Xs_tst))
            W_tst = LinearAlgebra.pinv(kernelmatrix(orientation, F, Xs_tst))

            KF = nystrom(orientation, F, X_tst, S)

            @test isapprox(KF.C, C_tst)
            @test isapprox(KF.W, W_tst)
        end
    end
end


text:
############################################################################
#
#  Quad_Forces.jl
#
#  Purpose:    Computes the forces and moments due to rotors.
#
#  Author:     Edward Daughtery
#
#  Date:       05 August 2016
#
#
############################################################################

function Quad_Forces(motor_array::Motors)

    ## Motor Rate (rad/s)
    wmotor1 = motor_array.motor1.position;
    wmotor2 = motor_array.motor2.position;
    wmotor3 = motor_array.motor3.position;
    wmotor4 = motor_array.motor4.position;

    ## Propeller Forces
    keng = 6.11e-4;
    f1_body = [0;0;-keng*wmotor1^2];
    f2_body = [0;0;-keng*wmotor2^2];
    f3_body = [0;0;-keng*wmotor3^2];
    f4_body = [0;0;-keng*wmotor4^2];

    ## Propeller Moments
    kmeng = 1.5e-5;
    m1_body = [0;0;-kmeng*wmotor1^2];
    m2_body = [0;0;kmeng*wmotor2^2];
    m3_body = [0;0;-kmeng*wmotor3^2];
    m4_body = [0;0;kmeng*wmotor4^2];

    ## Moment arm from CG to Propeller Hub;
    Larm = 0.15;
    r1_arm_body = [ Larm*cosd(45); -Larm*sind(45); 0.0];
    r2_arm_body = [ Larm*cosd(45);  Larm*sind(45); 0.0];
    r3_arm_body = [-Larm*cosd(45);  Larm*sind(45); 0.0];
    r4_arm_body = [-Larm*cosd(45); -Larm*sind(45); 0.0];

    ## Total Moment due to Motors
    m1_body = m1_body + cross(r1_arm_body, f1_body);
    m2_body = m2_body + cross(r2_arm_body, f2_body);
    m3_body = m3_body + cross(r3_arm_body, f3_body);
    m4_body = m4_body + cross(r4_arm_body, f4_body);

    ## Creating Quad Forces Structure
    quadforces = QuadForces(f1_body,
                            f2_body,
                            f3_body,
                            f4_body,
                            m1_body,
                            m2_body,
                            m3_body,
                            m4_body);

    return quadforces;
end


text:
export gmm_generate

import ..GMM

using mlpack._Internal.io

import mlpack_jll
const gmm_generateLibrary = mlpack_jll.libmlpack_julia_gmm_generate

# Call the C binding of the mlpack gmm_generate binding.
function gmm_generate_mlpackMain()
  success = ccall((:gmm_generate, gmm_generateLibrary), Bool, ())
  if !success
    # Throw an exception---false means there was a C++ exception.
    throw(ErrorException("mlpack binding error; see output"))
  end
end

" Internal module to hold utility functions. "
module gmm_generate_internal
  import ..gmm_generateLibrary

import ...GMM

# Get the value of a model pointer parameter of type GMM.
function IOGetParamGMM(paramName::String)::GMM
  GMM(ccall((:IO_GetParamGMMPtr, gmm_generateLibrary), Ptr{Nothing}, (Cstring,), paramName))
end

# Set the value of a model pointer parameter of type GMM.
function IOSetParamGMM(paramName::String, model::GMM)
  ccall((:IO_SetParamGMMPtr, gmm_generateLibrary), Nothing, (Cstring, Ptr{Nothing}), paramName, model.ptr)
end

# Serialize a model to the given stream.
function serializeGMM(stream::IO, model::GMM)
  buf_len = UInt[0]
  buf_ptr = ccall((:SerializeGMMPtr, gmm_generateLibrary), Ptr{UInt8}, (Ptr{Nothing}, Ptr{UInt}), model.ptr, Base.pointer(buf_len))
  buf = Base.unsafe_wrap(Vector{UInt8}, buf_ptr, buf_len[1]; own=true)
  write(stream, buf)
end
# Deserialize a model from the given stream.
function deserializeGMM(stream::IO)::GMM
  buffer = read(stream)
  GMM(ccall((:DeserializeGMMPtr, gmm_generateLibrary), Ptr{Nothing}, (Ptr{UInt8}, UInt), Base.pointer(buffer), length(buffer)))
end
end # module

"""
    gmm_generate(input_model, samples; [seed, verbose])

This program is able to generate samples from a pre-trained GMM (use gmm_train
to train a GMM).  The pre-trained GMM must be specified with the `input_model`
parameter.  The number of samples to generate is specified by the `samples`
parameter.  Output samples may be saved with the `output` output parameter.

The following command can be used to generate 100 samples from the pre-trained
GMM `gmm` and store those generated samples in `samples`:

```julia
julia> samples = gmm_generate(gmm, 100)
```

# Arguments

 - `input_model::GMM`: Input GMM model to generate samples from.
 - `samples::Int`: Number of samples to generate.
 - `seed::Int`: Random seed.  If 0, 'std::time(NULL)' is used.  Default
      value `0`.

 - `verbose::Bool`: Display informational messages and the full list of
      parameters and timers at the end of execution.  Default value `false`.

# Return values

 - `output::Array{Float64, 2}`: Matrix to save output samples in.

"""
function gmm_generate(input_model::GMM,
                      samples::Int;
                      seed::Union{Int, Missing} = missing,
                      verbose::Union{Bool, Missing} = missing,
                      points_are_rows::Bool = true)
  # Force the symbols to load.
  ccall((:loadSymbols, gmm_generateLibrary), Nothing, ());

  IORestoreSettings("GMM Sample Generator")

  # Process each input argument before calling mlpackMain().
  gmm_generate_internal.IOSetParamGMM("input_model", convert(GMM, input_model))
  IOSetParam("samples", samples)
  if !ismissing(seed)
    IOSetParam("seed", convert(Int, seed))
  end
  if verbose !== nothing && verbose === true
    IOEnableVerbose()
  else
    IODisableVerbose()
  end

  IOSetPassed("output")
  # Call the program.
  gmm_generate_mlpackMain()

  return IOGetParamMat("output", points_are_rows)
end


text:
using SymPy
N = 15
b = [symbols("b_$i", real=true) for i in 1:N]

# order 2
h = [1//2, 1, 1, 1]
H = Diagonal(h)

s = [-3//2, 2, -1//2, 0]

m1 = [(b[1]+b[2])/2, -(b[1]+b[2])/2, 0, 0]
m2 = [-(b[1]+b[2])/2, b[1]/2+b[2]+b[3]/2, -(b[2]+b[3])/2, 0]
m3 = [0, -(b[2]+b[3])/2, b[2]/2+b[3]+b[4]/2, -(b[3]+b[4])/2]
m4 = [0, 0, -(b[3]+b[4])/2, b[3]/2+b[4]+b[5]/2]
M = hcat(m1, m2, m3, m4)'

S = zeros(M)
S[1,:] = s

D2 = H \ (-M - b[1]*S)

# order 4
h = [17//48, 59//48, 43//48, 49//48, 1, 1, 1, 1]
H = Diagonal(h)

s = [-11//6, 3, -3//2, 1//3, 0, 0, 0, 0]

m1 = [12*b[1]//17 + 59//192*b[2] + 27010400129//345067064608*b[3] + 69462376031//2070402387648*b[4],
    -59//68*b[1] - 6025413881//21126554976*b[3] - 537416663//7042184992*b[4],
    2//17*b[1] - 59//192*b[2] + 213318005//16049630912*b[4]+2083938599//8024815456*b[3],
    3//68*b[1] - 1244724001//21126554976*b[3] + 752806667//21126554976*b[4],
    49579087//10149031312*b[3] - 49579087//10149031312*b[4],
    -1//784*b[4]+1//784*b[3],
    0, 0]
m2 = [m1[2],
    3481//3264*b[1] + BigInt(9258282831623875)//7669235228057664*b[3] + 236024329996203//1278205871342944*b[4],
    -59//408*b[1] - 29294615794607//29725717938208*b[3] - 2944673881023//29725717938208*b[4],
    -59//1088*b[1] + 260297319232891//2556411742685888*b[3] - 60834186813841//1278205871342944*b[4],
    -1328188692663//37594290333616*b[3] + 1328188692663//37594290333616*b[4],
    -8673//2904112*b[3] + 8673//2904112*b[4],
    0, 0]
m3 = [m1[3], m2[3],
    1//51*b[1] + 59//192*b[2] + 13777050223300597//26218083221499456*b[4] + 564461//13384296*b[5] + BigInt(378288882302546512209)//270764341349677687456*b[3],
    1//136*b[1] - 125059//743572*b[5] - 4836340090442187227//5525802884687299744*b[3] - 17220493277981//89177153814624*b[4],
    -10532412077335//42840005263888*b[4] + 1613976761032884305//7963657098519931984*b[3] + 564461//4461432*b[5],
    -960119//1280713392*b[4] - 3391//6692148*b[5] + 33235054191//26452850508784*b[3],
    0, 0]
m4 = [m1[4], m2[4], m3[4],
    3//1088*b[1] + BigInt(507284006600757858213)//475219048083107777984*b[3] + 1869103//2230716*b[5] + 1//24*b[6] + 1950062198436997//3834617614028832*b[4],
    -BigInt(4959271814984644613)//20965546238960637264*b[3] - 1//6*b[6] - 15998714909649//37594290333616*b[4] - 375177//743572*b[5],
    -368395//2230716*b[5] + 752806667//539854092016*b[3] + 1063649//8712336*b[4] + 1//8*b[6],
    0, 0]
m5 = [m1[5], m2[5], m3[5], m4[5],
    BigInt(8386761355510099813)//128413970713633903242*b[3] + 2224717261773437//2763180339520776*b[4] + 5//6*b[6] + 1//24*b[7] + 280535//371786*b[5],
    -35039615//213452232*b[4] - 1//6*b[7] - 13091810925//13226425254392*b[3] - 1118749//2230716*b[5] - 1//2*b[6],
    -1//6*b[6] + 1//8*b[5] + 1//8*b[7],
    0]
m6 = [m1[6], m2[6], m3[6], m4[6], m5[6],
    3290636//80044587*b[4] + 5580181//6692148*b[5] + 5//6*b[7] + 1//24*b[8] + 660204843//13226425254392*b[3] + 3//4*b[6],
    -1//6*b[5] - 1//6*b[8] - 1//2*b[6] - 1//2*b[7],
    -1//6*b[7] + 1//8*b[6] + 1//8*b[8]]
i=7; m7 = -[0, 0, 0, 0,
    b[i-1]/6 - b[i-2]/8 - b[i]/8,
    b[i-2]/6 + b[i+1]/6 + b[i-1]/2 + b[i]/2,
    -b[i-2]/24 - 5*b[i-1]/6 - 5*b[i+1]/6 - b[i+2]/24 - 3*b[i]/4,
    b[i-1]/6 + b[i+2]/6 + b[i]/2 + b[i+1]/2,
    #b[i+1]/6 - b[i]/8 - b[i+2]/8
    ]
i=8; m8 = -[0, 0, 0, 0, 0,
    b[i-1]/6 - b[i-2]/8 - b[i]/8,
    b[i-2]/6 + b[i+1]/6 + b[i-1]/2 + b[i]/2,
    -b[i-2]/24 - 5*b[i-1]/6 - 5*b[i+1]/6 - b[i+2]/24 - 3*b[i]/4,
    #b[i-1]/6 + b[i+2]/6 + b[i]/2 + b[i+1]/2,
    #b[i+1]/6 - b[i]/8 - b[i+2]/8
    ]
M = hcat(m1, m2, m3, m4, m5, m6, m7, m8)'

S = zeros(M)
S[1,:] = s

D2 = H \ (-M - b[1]*S)

# order 6
h = [13649//43200, 12013//8640, 2711//4320, 5359//4320, 7877//8640, 43801//43200,
    1, 1, 1, 1, 1, 1]
H = Diagonal(h)

s = [-25//12, 4, -3, 4//3, -1//4, 0, 0, 0, 0, 0, 0, 0]

ten = BigInt(10)//1
#ten = 10.
m1 = [
    # 1
    79126675946955820939/ten^20*b[1] + 29684720906380007429/ten^20*b[2] + 31855190887964290152/ten^22*b[3] + 16324040425909519534/ten^21*b[4] + 31603022440944150877/ten^21*b[5] + 31679647480161052996/ten^21*b[6] + 31485777339472539205/ten^21*b[7],
    # 2
    -10166893393503381444/ten^19*b[1] - 28456273704916113690/ten^21*b[3] - 41280298383492988198/ten^21*b[4] - 13922814516201405075/ten^20*b[5] - 11957773256112017666/ten^20*b[6] - 11942677565293334109/ten^20*b[7],
    # 3
    70756429372437150463/ten^21*b[1] - 18454761060241510503/ten^20*b[2] - 43641631471118923470/ten^21*b[4] + 24323679072077324609/ten^20*b[5] + 15821270735372154440/ten^20*b[6] + 16023485783647863076/ten^20*b[7],
    # 4
    22519915328913532127/ten^20*b[1] - 16627487110970548953/ten^20*b[2] + 27105309616486712977/ten^21*b[3] - 19166461859684399091/ten^20*b[5] - 76841171601990145944/ten^21*b[6] - 82195869498316975759/ten^21*b[7],
    # 5
    -52244034642020563167/ten^21*b[1] + 44400639485098762210/ten^21*b[2] - 10239765473093878745/ten^22*b[3] + 74034846453161740905/ten^21*b[4] + 12416255689984968954/ten^21*b[6] + 71886528478926012827/ten^21*b[5] + 13793629971047355034/ten^21*b[7],
    # 6
    -18288968138771973527/ten^21*b[1] + 95746331632217580607/ten^22*b[2] - 81057845305764042779/ten^23*b[3] - 73488455877755196984/ten^22*b[4] + 10636019497239069970/ten^21*b[5] - 13159670383826183824/ten^21*b[6] - 21179364788387535246/ten^21*b[7],
    # 7
    19118885633161709274/ten^22*b[4] - 40681303555291499361/ten^21*b[5] + 13196749810737491670/ten^21*b[6] + 25572665181237836763/ten^21*b[7],
    # 8
    15596528711367857640/ten^21*b[5] - 64861841573315378995/ten^22*b[6] - 91103445540363197401/ten^22*b[7],
    # 9
    55939836966298630593/ten^23*b[6] - 13848225351007963723/ten^22*b[5] + 82542416543781006633/ten^23*b[7],
    # 10
    0, 0, 0]
m2 = [m1[2],
    # 2 #TODO: Check
    13063321571116676286/ten^19*b[1] + 25420017604573457435/ten^20*b[3] + 10438978280925626095/ten^20*b[4] + 66723280210321129509/ten^20*b[5] + 46818193597227494411/ten^20*b[6] + 46764154101958369201/ten^20*b[7],
    # 3
    -90914102699924646049/ten^21*b[1] + 11036113131714764253/ten^20*b[4] - 12903975449975188870/ten^19*b[5] - 66396052487350447871/ten^20*b[6] - 66159744640052061842/ten^20*b[7],
    # 4
    -28935573956534316666/ten^20*b[1] - 24213200040645927216/ten^20*b[3] + 11876702550280310277/ten^19*b[5] + 39565981499041363328/ten^20*b[6] + 38600489217558000007/ten^20*b[7],
    # 5
    67127744758037639890/ten^21*b[1] + 91471926820756301800/ten^22*b[3] - 18721961430038080217/ten^20*b[4] - 13193585588531745301/ten^20*b[6] - 48715757368119118874/ten^20*b[5] - 10475163122754481381/ten^20*b[7],
    # 6
    23499279745900688694/ten^21*b[1] + 72409053835651813164/ten^22*b[3] + 18583789963916794487/ten^21*b[4] - 92896161339386761743/ten^21*b[5] + 12235132704188076670/ten^20*b[6] + 11135203204362950339/ten^20*b[7],
    # 7
    -48347914064469075906/ten^22*b[4] + 23106838326878204031/ten^20*b[5] - 10807741421960079917/ten^20*b[6] - 11815617764273433354/ten^20*b[7],
    # 8
    -83681414344034553537/ten^21*b[5] + 40934994667670546616/ten^21*b[6] + 42746419676364006921/ten^21*b[7],
    # 9
    -35765451326969831434/ten^22*b[6] + 73893991241210786821/ten^22*b[5] - 38128539914240955387/ten^22*b[7],
    # 10
    0, 0, 0]
m3 = [m1[3], m2[3],
    # 3
    63271611471368738078/ten^22*b[1] + 11473182007158685275/ten^20*b[2] + 11667405542796800075/ten^20*b[4] + 27666108082854440372/ten^19*b[5] + 10709206899608171042/ten^19*b[6] + 10131613910329730572/ten^19*b[7],
    # 4
    20137694138847972466/ten^21*b[1] + 10337179946308864017/ten^20*b[2] - 29132216211517427243/ten^19*b[5] - 87558073434822622598/ten^20*b[6] - 69099571834888124265/ten^20*b[7],
    # 5
    -46717510915754628683/ten^22*b[1] - 27603533656377128278/ten^21*b[2] - 19792902986208699745/ten^20*b[4] + 54029853383734330523/ten^20*b[6] + 12391775930319110779/ten^19*b[5] + 26280380502473582273/ten^20*b[7],
    # 6
    -16354308669218878195/ten^22*b[1] - 59524752758832596197/ten^22*b[2] + 19646827777442752194/ten^21*b[4] + 32366400126390466006/ten^20*b[5] - 46595166932288709739/ten^20*b[6] - 22172727209417368594/ten^20*b[7],
    # 7
    -51113531893524745496/ten^22*b[4] - 53558781637747543460/ten^20*b[5] + 33283351044897389336/ten^20*b[6] + 20786565911785401579/ten^20*b[7],
    # 8
    18243281741342895622/ten^20*b[5] - 10598160301968184459/ten^20*b[6] - 76451214393747111630/ten^21*b[7],
    # 9
    92090899634437994856/ten^22*b[6] - 15915028188724931671/ten^21*b[5] + 67059382252811321853/ten^22*b[7],
    # 10
    0, 0, 0]
m4 = [m1[4], m2[4], m3[4],
    # 4
    64092997759871869867/ten^21*b[1] + 93136576388046999489/ten^21*b[2] + 23063676246347492291/ten^20*b[3] + 36894403082837166203/ten^19*b[5] + 11905503386876088738/ten^19*b[6] + 59124795468888565194/ten^20*b[7],
    # 5
    -14868958192656041286/ten^21*b[1] - 24870405993901607642/ten^21*b[2] - 87129289077117541871/ten^22*b[3] - 12635078373718242057/ten^19*b[6] - 30583173978439973269/ten^20*b[7] - 14706919260458029548/ten^19*b[5],
    # 6
    -52051474298559556576/ten^22*b[1] - 53630987475285424890/ten^22*b[2] - 68971427657906095463/ten^22*b[3] - 78575245216674501017/ten^20*b[5] + 22911480054237346001/ten^20*b[7] + 99770643562927505292/ten^20*b[6],
    # 7
    66972974880676622652/ten^20*b[5] - 50132473560721279390/ten^20*b[6] - 17951612431066454373/ten^20*b[7],
    # 8
    -20229090601117515652/ten^20*b[5] + 14534218580636584986/ten^20*b[6] + 56948720204809306656/ten^21*b[7],
    # 9
    -12004296184410038337/ten^21*b[6] - 47769156693859238415/ten^22*b[7] + 16781211853795962179/ten^21*b[5],
    # 10
    0, 0, 0]
m5 = [m1[5], m2[5], m3[5], m4[5],
    # 5
    34494550959102336252/ten^22*b[1] + 66411834994278261016/ten^22*b[2] + 32915450832718628585/ten^23*b[3] + 33577217075764772000/ten^20*b[4] + 20964133295790264390/ten^19*b[6] + 23173232041831268550/ten^20*b[7] + 61078257643682645765/ten^22*b[8] + 71091258506833766956/ten^20*b[5],
    # 6
    12075440723041938061/ten^22*b[1] + 14321166657521476075/ten^22*b[2] + 26055826461832559573/ten^23*b[3] - 33329411132516353908/ten^21*b[4] - 28082416973855326836/ten^20*b[7] - 27209080835250836084/ten^21*b[8] + 10458654356829219874/ten^20*b[5] - 13484369866671155432/ten^19*b[6],
    # 7
    86710380841746926251/ten^22*b[4] + 17360734113554285637/ten^20*b[6] + 53313621252876254126/ten^21*b[8] - 24249352624045263018/ten^20*b[5] + 15690152576785882706/ten^20*b[7],
    # 8
    -86316839802171222760/ten^21*b[6] + 26988423604709992435/ten^21*b[7] + 80981941477156510853/ten^21*b[5] - 32764636390806391639/ten^21*b[8],
    # 9
    74620594845308550733/ten^22*b[6] - 81216403616686789496/ten^23*b[7] + 55227020881270902093/ten^23*b[8] - 72021656571766961993/ten^22*b[5],
    # 10
    0, 0, 0]
m6 = [m1[6], m2[6], m3[6], m4[6], m5[6],
    # 6
    42272261734493450425/ten^23*b[1] + 30882419443789644048/ten^23*b[2] + 20625757066474306202/ten^23*b[3] + 33083434042009682567/ten^22*b[4] + 58280470164050018158/ten^20*b[5] + 80541742203662154736/ten^20*b[7] + 13383632334100334433/ten^20*b[8] + 1//180*b[9] + 11903620718618930511/ten^19*b[6],
    # 7
    -86070442526864133026/ten^23*b[4] - 17480747086739049893/ten^20*b[5] - 31325448501150501650/ten^20*b[8] - 25000000000000000000/ten^21*b[9] - 31691663053104292713/ten^20*b[7] - 66916070916479291611/ten^20*b[6],
    # 8
    33546617916933521087/ten^21*b[5] - 33436200223869714050/ten^20*b[7] + 50000000000000000000/ten^21*b[9] + 21697906098076027508/ten^20*b[6] + 18383632334100334433/ten^20*b[8],
    # 9
    29125184768230046430/ten^21*b[7] + 22790919164749163916/ten^21*b[8] - 30689859975187405305/ten^21*b[6] - 17817995133473605962/ten^22*b[5] - 30555555555555555556/ten^21*b[9],
    # 10
    0, 0, 0]
i=7; m7 = [m1[7], m2[7], m3[7], m4[7], m5[7], m6[7],
    # 7
    22392237357715991790/ten^23*b[4] + 12754377854309566738/ten^20*b[5] + 10116994839296081646/ten^19*b[6] + 96988172751725752475/ten^20*b[8] + 12500000000000000000/ten^20*b[9] + 1//180*b[10] + 48231775430312815001/ten^20*b[7],
    # 8
    -37841139730330129499/ten^21*b[5] - 29975568851348273616/ten^20*b[6] - 30000000000000000000/ten^20*b[9] - 25000000000000000000/ten^21*b[10] - 39914868674468211784/ten^20*b[7] - 43825448501150501650/ten^20*b[8],
    # 9
    46981462180226839339/ten^21*b[6] - 29668637874712374587/ten^20*b[8] + 50000000000000000000/ten^21*b[10] + 17163557041460064817/ten^20*b[7] + 30693461522962583624/ten^22*b[5] + 17500000000000000000/ten^20*b[9],
    # 10
    1//40*b[i+1] + 1//40*b[i+2] - 11//360*b[i+3] - 11//360*b[i],
    # 11
    0, 0]
i=8; m8 = [m1[8], m2[8], m3[8], m4[8], m5[8], m6[8], m7[8],
    # 8
    12303289427168044554/ten^21*b[5] + 11836475296458983325/ten^20*b[6] + 94105118982279433342/ten^20*b[7] + 95000000000000000000/ten^20*b[9] + 12500000000000000000/ten^20*b[10] + 1//180*b[11] + 56994743445211445545/ten^20*b[8],
    # 9
    -23080678926719163396/ten^21*b[6] - 29866250537751494972/ten^20*b[7] - 30000000000000000000/ten^20*b[10] - 25000000000000000000/ten^21*b[11] - 10477348605150508026/ten^22*b[5] - 42720908083525083608/ten^20*b[8] - 42500000000000000000/ten^20*b[9],
    # 10
    1//20*b[i+3] - 3//10*b[i+1] + 1//20*b[i-1] + 7//40*b[i] + 7//40*b[i+2],
    # 11
    1//40*b[i+1] + 1//40*b[i+2] - 11//360*b[i+3] - 11//360*b[i],
    # 12
    0]
i=9; m9 = [m1[9], m2[9], m3[9], m4[9], m5[9], m6[9], m7[9], m8[9],
    # 9
    51393702211491099770/ten^22*b[6] + 12477232150094220014/ten^20*b[7] + 95055227020881270902/ten^20*b[8] + 95000000000000000000/ten^20*b[10] + 12500000000000000000/ten^20*b[11] + 1//180*b[12] + 91593624651536418269/ten^24*b[5] + 56111111111111111111/ten^20*b[9],
    # 10
    -1//40*b[i+3] - 3//10*b[i+2] - 3//10*b[i-1] - 1//40*b[i-2] - 17//40*b[i] - 17//40*b[i+1],
    # 11
    1//20*b[i+3] - 3//10*b[i+1] + 1//20*b[i-1] + 7//40*b[i] + 7//40*b[i+2],
    # 12
    1//40*b[i+1] + 1//40*b[i+2] - 11//360*b[i+3] - 11//360*b[i],
    ]
i=10; m10 = [0, 0, 0, 0, 0, 0,
    1//40*b[i-1] + 1//40*b[i-2] - 11//360*b[i-3] - 11//360*b[i],
    1//20*b[i-3] - 3//10*b[i-1] + 1//20*b[i+1] + 7//40*b[i] + 7//40*b[i-2],
    -1//40*b[i-3] - 3//10*b[i-2] - 3//10*b[i+1] - 1//40*b[i+2] - 17//40*b[i] - 17//40*b[i-1],
    1//180*b[i-3] + 1//8*b[i-2] + 19//20*b[i-1] + 19//20*b[i+1] + 1//8*b[i+2] + 1//180*b[i+3] + 101//180*b[i],
    -1//40*b[i+3] - 3//10*b[i+2] - 3//10*b[i-1] - 1//40*b[i-2] - 17//40*b[i] - 17//40*b[i+1],
    1//20*b[i+3] - 3//10*b[i+1] + 1//20*b[i-1] + 7//40*b[i] + 7//40*b[i+2],
    #1//40*b[i+1] + 1//40*b[i+2] - 11//360*b[i+3] - 11//360*b[i],
    ]
i=11; m11 = [0, 0, 0, 0, 0, 0, 0,
    1//40*b[i-1] + 1//40*b[i-2] - 11//360*b[i-3] - 11//360*b[i],
    1//20*b[i-3] - 3//10*b[i-1] + 1//20*b[i+1] + 7//40*b[i] + 7//40*b[i-2],
    -1//40*b[i-3] - 3//10*b[i-2] - 3//10*b[i+1] - 1//40*b[i+2] - 17//40*b[i] - 17//40*b[i-1],
    1//180*b[i-3] + 1//8*b[i-2] + 19//20*b[i-1] + 19//20*b[i+1] + 1//8*b[i+2] + 1//180*b[i+3] + 101//180*b[i],
    -1//40*b[i+3] - 3//10*b[i+2] - 3//10*b[i-1] - 1//40*b[i-2] - 17//40*b[i] - 17//40*b[i+1],
    ]
i=12; m12 = [0, 0, 0, 0, 0, 0, 0, 0,
    1//40*b[i-1] + 1//40*b[i-2] - 11//360*b[i-3] - 11//360*b[i],
    1//20*b[i-3] - 3//10*b[i-1] + 1//20*b[i+1] + 7//40*b[i] + 7//40*b[i-2],
    -1//40*b[i-3] - 3//10*b[i-2] - 3//10*b[i+1] - 1//40*b[i+2] - 17//40*b[i] - 17//40*b[i-1],
    1//180*b[i-3] + 1//8*b[i-2] + 19//20*b[i-1] + 19//20*b[i+1] + 1//8*b[i+2] + 1//180*b[i+3] + 101//180*b[i],
    ]
M = hcat(m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12)'

S = zeros(M)
S[1,:] = s

D2 = H \ (-M - b[1]*S)

# write coefficients to file
open("test.txt", "w") do io
    reg = r"\*b_\d+/"
    for i in 1:9, j in 1:size(D2, 2)
        s = string(D2[i,j])
        parts = split(replace(replace(filter(!isspace, s), "+", " + "), "-", " + -"), " + ")
        for part in parts
            m = match(reg, part)
            m == nothing && continue
            k = parse(Int, m.match[4:end-1])
            term = replace(part, m.match, "//")
            @printf(io, "        d%02i%02i%02i = T(%s)\n", i, j, k, term)
        end
    end
end

open("test.txt", "w") do io
    reg = r"\*b_\d+/"
    for i in 1:9, j in 1:size(D2, 2)
        s = string(D2[i,j])
        parts = split(replace(replace(filter(!isspace, s), "+", " + "), "-", " + -"), " + ")
        for part in parts
            m = match(reg, part)
            m == nothing && continue
            k = parse(Int, m.match[4:end-1])
            @printf(io, "    d%02i%02i%02i::T\n", i, j, k)
        end
    end
end

open("test.txt", "w") do io
    reg = r"\*b_\d+/"
    for i in 1:9, j in 1:size(D2, 2)
        s = string(D2[i,j])
        parts = split(replace(replace(filter(!isspace, s), "+", " + "), "-", " + -"), " + ")
        for part in parts
            m = match(reg, part)
            m == nothing && continue
            k = parse(Int, m.match[4:end-1])
            @printf(io, "d%02i%02i%02i, ", i, j, k)
        end
        print(io, "\n")
    end
end

# write boundary code
open("test.txt", "w") do io
    reg = r"\*b_\d+/"
    for i in 1:9
        i > 1 && print(io, "\n")
        @printf(io, "        dest[%3i] = α * (\n", i)
        for j in 1:size(D2, 2)
            s = string(D2[i,j])
            parts = split(replace(replace(filter(!isspace, s), "+", " + "), "-", " + -"), " + ")

            print(io, "    "^6)
            if j == 1
                print(io, "  ")
            end
            part_idx = 0
            for part in parts
                m = match(reg, part)
                m == nothing && continue
                part_idx = part_idx + 1
                k = parse(Int, m.match[4:end-1])
                if part_idx == 1 && j == 1
                    @printf(io, "(d%02i%02i%02i*b[%2i]", i, j, k, k)
                elseif part_idx == 1
                    @printf(io, "+ (d%02i%02i%02i*b[%2i]", i, j, k, k)
                else
                    @printf(io, " + d%02i%02i%02i*b[%2i]", i, j, k, k)
                end
            end
            if part_idx != 0
                @printf(io, ") * u[%2i]\n", j)
            end
        end
    end
end


text:
using ADMPS
using ADMPS:HamiltonianModel

@testset "hamiltonianmodels" begin
    @test Ising(1.0) isa HamiltonianModel
end


text:
# global
# ======

"""
    X_CODE_CACHE::$(typeof(X_CODE_CACHE))

Keeps `CodeInstance` cache associated with `mi::MethodInstace` that represent the result of
an inference on `mi` performed by `XInterpreter`.
The cache is partitioned by identities of each `XInterpreter`, and thus running a pipeline
with different configurations will yeild a different cache and never influenced by the
previous inference.
This cache is completely separated from the `NativeInterpreter`'s global cache, so that
XCompiler.jl's analysis never interacts with actual code execution (like, execution of `XCompiler` itself).
"""
const X_CODE_CACHE = IdDict{UInt, IdDict{MethodInstance,CodeInstance}}()

__init_cache!(h::UInt) = X_CODE_CACHE[h] = IdDict{MethodInstance,CodeInstance}()
__clear_cache!()       = empty!(X_CODE_CACHE)

function CC.code_cache(interp::XInterpreter)
    cache = XGlobalCache(interp)
    worlds = WorldRange(get_world_counter(interp))
    return WorldView(cache, worlds)
end

struct XGlobalCache
    interp::XInterpreter
end

# cache existence for this `analyzer` is ensured on its construction
x_code_cache(interp::XInterpreter)         = X_CODE_CACHE[interp.cache_key]
x_code_cache(wvc::WorldView{XGlobalCache}) = x_code_cache(wvc.cache.interp)

CC.haskey(wvc::WorldView{XGlobalCache}, mi::MethodInstance) = haskey(x_code_cache(wvc), mi)

function CC.get(wvc::WorldView{XGlobalCache}, mi::MethodInstance, default)
    ret = get(x_code_cache(wvc), mi, default)

    return ret
end

function CC.getindex(wvc::WorldView{XGlobalCache}, mi::MethodInstance)
    r = CC.get(wvc, mi, nothing)
    r === nothing && throw(KeyError(mi))
    return r::CodeInstance
end

function CC.setindex!(wvc::WorldView{XGlobalCache}, ci::CodeInstance, mi::MethodInstance)
    setindex!(x_code_cache(wvc), ci, mi)
    add_x_callback!(mi) # register the callback on invalidation
    return nothing
end

function add_x_callback!(linfo)
    if !isdefined(linfo, :callbacks)
        linfo.callbacks = Any[invalidate_x_cache!]
    else
        if !any(@nospecialize(cb)->cb===invalidate_x_cache!, linfo.callbacks)
            push!(linfo.callbacks, invalidate_x_cache!)
        end
    end
    return nothing
end

function invalidate_x_cache!(replaced, max_world, depth = 0)
    for cache in values(X_CODE_CACHE); delete!(cache, replaced); end

    if isdefined(replaced, :backedges)
        for mi in replaced.backedges
            mi = mi::MethodInstance
            if !any(cache->haskey(cache, mi), values(X_CODE_CACHE))
                continue # otherwise fall into infinite loop
            end
            invalidate_x_cache!(mi, max_world, depth+1)
        end
    end
    return nothing
end

# local
# =====

# to inspect local cache, we will just look for `get_inference_cache(interp.native)`
# and thus we won't create a global store to hold these caches

CC.get_inference_cache(interp::XInterpreter) = XLocalCache(interp)

struct XLocalCache
    interp::XInterpreter
end

# just bypass to the native one
function CC.cache_lookup(linfo::MethodInstance, given_argtypes::Vector{Any}, inf_cache::XLocalCache)
    ret = cache_lookup(linfo, given_argtypes, get_inference_cache(inf_cache.interp.native))

    return ret
end

# just bypass to the native one
function CC.push!(inf_cache::XLocalCache, inf_result::InferenceResult)
    ret = CC.push!(get_inference_cache(inf_cache.interp.native), inf_result)

    return ret
end


text:
function correctvolume!(system::CVSystem,n::Int64)
    # get current volume
    CVModule.updatevolumes!(system,n);

    # find error in volume
    error = system.finalvolume + (system.hemo.Vloss - system.hemo.Vlossinit) - system.initialvolume;

    # divide error proportionally to accumulation regions
    lungerror1 = 0.05*error;
    lungerror2 = 0.25*error;
    termerror = 0.5*error;
    lverror = 0.1*error;
    rverror = 0.1*error;

    # subtract erroneous volume to maintain mass conservation
    system.lungs.Vv[n+2,1] -= lungerror1;
    system.lungs.Vv[n+2,2] -= lungerror2;
    system.heart.lv.V[n+2] -= lverror;
    system.heart.rv.V[n+2] -= rverror;

    numterms = 0;
    for i = 1:length(system.branches.ID)
        if isempty(system.branches.children[i])
            numterms+=1;
        end
    end
    termerror = termerror/numterms;
    for i = 1:length(system.branches.ID)
        if isempty(system.branches.children[i])
            system.branches.term[i].V[n+2,5] -= termerror;
        end
    end
end

max_stars_repo_name: dcanuto/CardioModeling

max_issues_repo_name: dcanuto/CardioModeling

max_forks_repo_name: dcanuto/CardioModeling


text:
abstract type FastLayer <: Function end

paramlength(f) = 0
initial_params(f) = Float32[]
initial_params(f::Chain) = Flux.destructure(f)[1]

struct FastChain{T<:Tuple} <: FastLayer
  layers::T
  function FastChain(xs...)
    layers = getfunc.(xs)
    new{typeof(layers)}(layers)
  end
end
getfunc(x) = x
getfunc(x::Tuple) = first(x)
getparams(x) = Float32[]
getparams(x::Tuple) = last(x)

applychain(::Tuple{}, x, p) = x
applychain(fs::Tuple, x, p) = applychain(Base.tail(fs), first(fs)(x,p[1:paramlength(first(fs))]), p[(paramlength(first(fs))+1):end])
(c::FastChain)(x,p) = applychain(c.layers, x, p)
paramlength(c::FastChain) = sum(paramlength(x) for x in c.layers)
initial_params(c::FastChain) = vcat(initial_params.(c.layers)...)

"""
FastDense(in,out,activation=identity;
          initW = Flux.glorot_uniform, initb = Flux.zeros)

A Dense layer `activation.(W*x + b)` with input size `in` and output size `out`.
The `activation` function defaults to `identity`, meaning the layer is an affine
function. Initial parameters are taken to match `Flux.Dense`.

Note that this function has specializations on `tanh` for a slightly faster
adjoint with Zygote.
"""
struct FastDense{F,F2} <: FastLayer
  out::Int
  in::Int
  σ::F
  initial_params::F2
  function FastDense(in::Integer, out::Integer, σ = identity;
                 initW = Flux.glorot_uniform, initb = Flux.zeros)
    initial_params() = vcat(vec(initW(out, in)),initb(out))
    new{typeof(σ),typeof(initial_params)}(out,in,σ,initial_params)
  end
end
# (f::FastDense)(x,p) = f.σ.(reshape(uview(p,1:(f.out*f.in)),f.out,f.in)*x .+ uview(p,(f.out*f.in+1):lastindex(p)))
(f::FastDense)(x,p) = f.σ.(reshape(p[1:(f.out*f.in)],f.out,f.in)*x .+ p[(f.out*f.in+1):end])
ZygoteRules.@adjoint function (f::FastDense)(x,p)
  if !isgpu(p)
    W = @view p[reshape(1:(f.out*f.in),f.out,f.in)]
  else
    W = reshape(@view(p[1:(f.out*f.in)]),f.out,f.in)
  end

  b = p[(f.out*f.in+1):end]
  r = W*x .+ b
  ifgpufree(b)

  #=
  if typeof(x) <: AbstractVector
    r = p[(f.out*f.in+1):end]
    mul!(r,W,x,one(eltype(x)),one(eltype(x)))
  else
    b = @view p[(f.out*f.in+1):end]
    r = reshape(repeat(b,outer=size(x,2)),length(b),size(x,2))
    mul!(r,W,x,one(eltype(x)),one(eltype(x)))
  end
  =#

  y = f.σ.(r)

  if typeof(f.σ) <: typeof(tanh)
    ifgpufree(r)
  end

  function FastDense_adjoint(ȳ)
    if typeof(f.σ) <: typeof(tanh)
      zbar = ȳ .* (1 .- y.^2)
    elseif typeof(f.σ) <: typeof(identity)
      zbar = ȳ
      ifgpufree(r)
    else
      zbar = ȳ .* ForwardDiff.derivative.(f.σ,r)
      ifgpufree(r)
    end
    ifgpufree(y)
    Wbar = zbar * x'
    bbar = zbar
    xbar = W' * zbar
    pbar = typeof(bbar) <: AbstractVector ?
                             vec(vcat(vec(Wbar),bbar)) :
                             vec(vcat(vec(Wbar),sum(bbar,dims=2)))
    ifgpufree(Wbar); ifgpufree(bbar); ifgpufree(ȳ)
    nothing,xbar,pbar
  end
  y,FastDense_adjoint
end
paramlength(f::FastDense) = f.out*(f.in + 1)
initial_params(f::FastDense) = f.initial_params()

"""
StaticDense(in,out,activation=identity;
          initW = Flux.glorot_uniform, initb = Flux.zeros)

A Dense layer `activation.(W*x + b)` with input size `in` and output size `out`.
The `activation` function defaults to `identity`, meaning the layer is an affine
function. Initial parameters are taken to match `Flux.Dense`. The internal
calculations are done with `StaticArrays` for extra speed for small linear
algebra operations. Should only be used for input/output sizes of approximately
16 or less.

Note that this function has specializations on `tanh` for a slightly faster
adjoint with Zygote.
"""
struct StaticDense{out,in,F,F2} <: FastLayer
  σ::F
  initial_params::F2
  function StaticDense(in::Integer, out::Integer, σ = identity;
                 initW = Flux.glorot_uniform, initb = Flux.zeros)
    initial_params() = vcat(vec(initW(out, in)),initb(out))
    new{out,in,typeof(σ),typeof(initial_params)}(σ,initial_params)
  end
end

function param2Wb(f::StaticDense{out,in}, p) where {out,in}
  _W, _b = @views p[1:(out*in)], p[(out*in+1):end]
  W = @inbounds convert(SMatrix{out,in},_W)
  b = @inbounds SVector{out}(_b)
  return W, b
end
function (f::StaticDense{out,in})(x,p) where {out,in}
  W, b = param2Wb(f, p)
  f.σ.(W*x .+ b)
end
ZygoteRules.@adjoint function (f::StaticDense{out,in})(x,p) where {out,in}
  W, b = param2Wb(f, p)
  r = W*x .+ b
  y = f.σ.(r)
  function StaticDense_adjoint(ȳ)
    if typeof(f.σ) <: typeof(tanh)
      σbar = 1 .- y.^2
    else
      σbar = ForwardDiff.derivative.(f.σ,r)
    end
    if typeof(ȳ) <: AbstractMatrix
      error("StaticDense only supports vector data")
    end
    zbar = SVector{out}(ȳ) .* σbar
    Wbar = zbar * SVector{in}(x)'
    bbar = zbar
    xbar = W' * zbar
    pbar = typeof(bbar) <: AbstractVector ?
                             vec(vcat(vec(Wbar),bbar)) :
                             vec(vcat(vec(Wbar),sum(bbar,dims=2)))
    xbar_out = x isa SArray ? xbar : adapt(typeof(x),xbar)
    pbar_out = p isa SArray ? pbar : adapt(typeof(p),pbar)
    nothing,xbar_out,pbar_out
  end
  y,StaticDense_adjoint
end
paramlength(f::StaticDense{out,in}) where {out,in} = out*(in + 1)
initial_params(f::StaticDense) = f.initial_params()


text:
struct WCopula{d} <: Copula{d} end
WCopula(d) = WCopula{d}()
Distributions.cdf(::WCopula{d},u) where {d} = max(1 + sum(u)-d,0)
function Distributions._rand!(rng::Distributions.AbstractRNG, ::WCopula{d}, x::AbstractVector{T}) where {d,T<:Real}
    @assert d==2
    x[1] = rand(rng)
    x[2] = 1-x[1]
end
function Base.rand(rng::Distributions.AbstractRNG,::WCopula{d}) where {d}
    @assert d==2
    x = rand(rng)
    [x,1-x]
end


text:
using ITensors
using Test

@testset "Scalar ITensors" begin
  A = ITensor(2.4)
  @test storage(A) isa ITensors.Dense{Float64}
  @test ndims(A) == 0
  @test order(A) == 0
  @test A[] == 2.4
  @test A[1] == 2.4
  @test scalar(A) == 2.4
  @test ITensors.symmetrystyle(A) == ITensors.NonQN()

  A[] = 3.4
  @test ndims(A) == 0
  @test order(A) == 0
  @test A[] == 3.4
  @test A[1] == 3.4
  @test scalar(A) == 3.4
  @test ITensors.symmetrystyle(A) == ITensors.NonQN()

  A[1] = 4.4
  @test ndims(A) == 0
  @test order(A) == 0
  @test A[] == 4.4
  @test A[1] == 4.4
  @test scalar(A) == 4.4
  @test ITensors.symmetrystyle(A) == ITensors.NonQN()

  A = ITensor()
  @test storage(A) isa ITensors.EmptyStorage{ITensors.EmptyNumber}
  @test ndims(A) == 0
  @test order(A) == 0
  @test A[] == 0.0
  @test A[1] == 0.0
  @test scalar(A) == 0.0
  @test ITensors.symmetrystyle(A) == ITensors.NonQN()

  A = ITensor()
  @test storage(A) isa ITensors.EmptyStorage{ITensors.EmptyNumber}
  A[] = 3.4
  @test storage(A) isa ITensors.Dense{Float64}
  @test ndims(A) == 0
  @test order(A) == 0
  @test A[] == 3.4
  @test A[1] == 3.4
  @test scalar(A) == 3.4
  @test ITensors.symmetrystyle(A) == ITensors.NonQN()

  A = ITensor()
  @test storage(A) isa ITensors.EmptyStorage{ITensors.EmptyNumber}
  A[1] = 4.4
  @test storage(A) isa ITensors.Dense{Float64}
  @test ndims(A) == 0
  @test order(A) == 0
  @test A[] == 4.4
  @test A[1] == 4.4
  @test scalar(A) == 4.4
  @test ITensors.symmetrystyle(A) == ITensors.NonQN()

  @test_throws ErrorException ITensor([2.5])
end

nothing