def test_ceiling_withCompareFunctionAndArgumentNotInBSTHavingCeilingValue_shouldReturnSmallerStrictlyGreaterElementFromBST( self): bst = AVLTree(self.cmp) for i in range(10): bst.put([0, i], i) for i in range(10): self.assertEqual([0, i], bst.ceiling([0, i - 0.5]))
def test_ceiling_withArgumentNotInBSTHavingCeilingValue_shouldReturnSmallerStrictlyGreaterElementFromBST( self): bst = AVLTree() for i in range(10): bst.put(i, i) for i in range(10): self.assertEqual(i, bst.ceiling(i - 0.5))
def test_ceiling_withCompareFunctionAndArgumentNotHavingCeilingValue_shouldReturnNone( self): bst = AVLTree(self.cmp) bst.put([0, 1], 1) self.assertIsNone(bst.ceiling([0, 2]))
def test_ceiling_withArgumentInBST_shouldReturnGivenArgument(self): bst = AVLTree() for i in range(10): bst.put(i, i) for i in range(10): self.assertEqual(i, bst.ceiling(i))
def test_ceiling_withEmptyBST_shouldReturnNone(self): bst = AVLTree() for i in range(200): self.assertIsNone(bst.ceiling(i))