Package com.google.common.collect.BstTesting

Examples of com.google.common.collect.BstTesting.SimpleNode


    assertTrue(node.hasChild(side));
    assertEquals(expectedChild, node.getChild(side));
  }

  public void testHasChildLeaf() {
    SimpleNode leaf = new SimpleNode('a', null, null);
    testLacksChild(leaf, LEFT);
    testLacksChild(leaf, RIGHT);
  }
View Full Code Here


    testLacksChild(leaf, LEFT);
    testLacksChild(leaf, RIGHT);
  }

  public void testHasChildLeftOnly() {
    SimpleNode leaf = new SimpleNode('a', null, null);
    SimpleNode node = new SimpleNode('b', leaf, null);
    testChildIs(node, LEFT, leaf);
    testLacksChild(node, RIGHT);
  }
View Full Code Here

    testChildIs(node, LEFT, leaf);
    testLacksChild(node, RIGHT);
  }

  public void testHasChildRightOnly() {
    SimpleNode leaf = new SimpleNode('c', null, null);
    SimpleNode node = new SimpleNode('b', null, leaf);
    testLacksChild(node, LEFT);
    testChildIs(node, RIGHT, leaf);
  }
View Full Code Here

    testLacksChild(node, LEFT);
    testChildIs(node, RIGHT, leaf);
  }

  public void testHasChildBoth() {
    SimpleNode left = new SimpleNode('a', null, null);
    SimpleNode right = new SimpleNode('c', null, null);
    SimpleNode node = new SimpleNode('b', left, right);
    testChildIs(node, LEFT, left);
    testChildIs(node, RIGHT, right);
  }
View Full Code Here

  public void testOrderingInvariantHoldsForGood() {
    for (SimpleNode left : GOOD_LEFTS) {
      for (SimpleNode right : GOOD_RIGHTS) {
        assertTrue(
            new SimpleNode(MIDDLE_KEY, left, right).orderingInvariantHolds(Ordering.natural()));
      }
    }
  }
View Full Code Here

  public void testOrderingInvariantBadLeft() {
    for (SimpleNode left : BAD_LEFTS) {
      for (SimpleNode right : ALL_RIGHTS) {
        assertFalse(
            new SimpleNode(MIDDLE_KEY, left, right).orderingInvariantHolds(Ordering.natural()));
      }
    }
  }
View Full Code Here

  public void testOrderingInvariantBadRight() {
    for (SimpleNode left : ALL_LEFTS) {
      for (SimpleNode right : BAD_RIGHTS) {
        assertFalse(
            new SimpleNode(MIDDLE_KEY, left, right).orderingInvariantHolds(Ordering.natural()));
      }
    }
  }
View Full Code Here

    assertEquals(MODEL.size(), BstRangeOps.totalInRange(
        countAggregate, GeneralRange.<Character>all(Ordering.natural()), ROOT));
  }

  public void testCountInRangeEmpty() {
    SimpleNode empty = null;
    GeneralRange<Character> range = GeneralRange.all(Ordering.natural());
    assertEquals(0, BstRangeOps.totalInRange(countAggregate, range, empty));
  }
View Full Code Here

    //     d
    //    / \
    //   b   f
    //  /   / \
    //  a   e g
    SimpleNode a = new SimpleNode('a', null, null);
    SimpleNode b = new SimpleNode('b', a, null);
    SimpleNode e = new SimpleNode('e', null, null);
    SimpleNode g = new SimpleNode('g', null, null);
    SimpleNode f = new SimpleNode('f', e, g);
    SimpleNode d = new SimpleNode('d', b, f);

    assertInOrderTraversalIs(d, "abdefg");
    GeneralRange<Character> range1 = GeneralRange.downTo(Ordering.natural(), 'f', CLOSED);
    testTraversalAfterClearingRangeIs(d, range1, "abde");
View Full Code Here

    //     d
    //    / \
    //   b   f
    //  /   / \
    //  a   e g
    SimpleNode a = new SimpleNode('a', null, null);
    SimpleNode b = new SimpleNode('b', a, null);
    SimpleNode e = new SimpleNode('e', null, null);
    SimpleNode g = new SimpleNode('g', null, null);
    SimpleNode f = new SimpleNode('f', e, g);
    SimpleNode d = new SimpleNode('d', b, f);

    assertInOrderTraversalIs(d, "abdefg");
    GeneralRange<Character> range1 = GeneralRange.upTo(Ordering.natural(), 'f', CLOSED);
    testTraversalAfterClearingRangeIs(d, range1, "g");
View Full Code Here

TOP

Related Classes of com.google.common.collect.BstTesting.SimpleNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.