Class PartiallyOrderedSetTest

  • public class PartiallyOrderedSetTest
    extends java.lang.Object
    Unit test for PartiallyOrderedSet.
    • Field Detail

      • SCALE

        private static final int SCALE
      • seed

        final long seed
      • random

        final java.util.Random random

        static final org.apache.calcite.util.PartiallyOrderedSet.Ordering<java.lang.String> STRING_SUBSET_ORDERING
    • Constructor Detail

      • PartiallyOrderedSetTest

        public PartiallyOrderedSetTest()
    • Method Detail

      • isDivisor

        private static boolean isDivisor​(int e1,
                                         int e2)
        As an ordering, integers are ordered by division. Top is 1, its children are primes, etc.
      • isDivisorInverse

        private static boolean isDivisorInverse​(java.lang.Integer e1,
                                                java.lang.Integer e2)
        As an ordering, bottom is 1, parents are primes, etc.
      • isBitSubset

        private static boolean isBitSubset​(int e1,
                                           int e2)
        As an ordering, integers are ordered by bit inclusion. E.g. the children of 14 (1110) are 12 (1100), 10 (1010) and 6 (0110).
      • isBitSuperset

        private static boolean isBitSuperset​(java.lang.Integer e1,
                                             java.lang.Integer e2)
        As an ordering, integers are ordered by bit inclusion. E.g. the parents of 14 (1110) are 12 (1100), 10 (1010) and 6 (0110).
      • testPoset

        public void testPoset()
      • testPosetTricky

        public void testPosetTricky()
      • testPosetBits

        public void testPosetBits()
      • testPosetBitsLarge

        public void testPosetBitsLarge()
      • testPosetBitsLarge2

        public void testPosetBitsLarge2()
      • checkPosetBitsLarge

        void checkPosetBitsLarge​(org.apache.calcite.util.PartiallyOrderedSet<java.lang.Integer> poset,
                                 int n,
                                 int expectedSize,
                                 int expectedParentCount)
      • testPosetBitsRemoveParent

        public void testPosetBitsRemoveParent()
      • testDivisorPoset

        public void testDivisorPoset()
      • testDivisorSeries

        public void testDivisorSeries()
      • testDivisorRandom

        public void testDivisorRandom()
      • testDivisorRandomWithRemoval

        public void testDivisorRandomWithRemoval()
      • testDivisorInverseSeries

        public void testDivisorInverseSeries()
      • testDivisorInverseRandom

        public void testDivisorInverseRandom()
      • testDivisorInverseRandomWithRemoval

        public void testDivisorInverseRandomWithRemoval()
      • testSubsetSeries

        public void testSubsetSeries()
      • testSubsetRandom

        public void testSubsetRandom()
      • printValidate

        private <E> void printValidate​(org.apache.calcite.util.PartiallyOrderedSet<E> poset)
      • checkPoset

        public void checkPoset​(org.apache.calcite.util.PartiallyOrderedSet.Ordering<java.lang.Integer> ordering,
                               boolean debug,
                               java.lang.Iterable<java.lang.Integer> generator,
                               boolean remove)
      • dump

        private <E> void dump​(org.apache.calcite.util.PartiallyOrderedSet<E> poset)
      • range

        private static java.util.Collection<java.lang.Integer> range​(int start,
                                                                     int end)
      • random

        private static java.lang.Iterable<java.lang.Integer> random​(java.util.Random random,
                                                                    int size,
                                                                    int max)
      • assertEqualsList

        private static void assertEqualsList​(java.lang.String expected,
                                             java.util.List<java.lang.String> ss)