function assertAvlTree(comparator, node) {
  if (node) {
    assertTrue(node.height < 1.4405 * Math.log2(node.count + 2) - 0.3277);
    assertTrue(node.height >= Math.log2(node.count + 1));
    let expectedCount = 1;
    let balanceFactor = 0;
    if (node.left) {
      balanceFactor -= node.left.height;
      expectedCount += node.left.count;
      assertTrue(comparator(node.value, node.left.value) > 0);
      assertAvlTree(node.left);
    }
    if (node.right) {
      balanceFactor += node.right.height;
      expectedCount += node.right.count;
      assertTrue(comparator(node.value, node.right.value) < 0);
      assertAvlTree(node.right);
    }
    assertTrue(Math.abs(balanceFactor) < 2);
    assertEquals(expectedCount, node.count);
  }
}
Asserts expected properties of an AVL tree.
@param {function(?, ?): number} comparator
@param {?} node
@suppress {checkTypes} suppression added to enable type checking