コード例 #1
0
 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]))
コード例 #2
0
 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))
コード例 #3
0
 def test_ceiling_withCompareFunctionAndArgumentNotHavingCeilingValue_shouldReturnNone(
         self):
     bst = AVLTree(self.cmp)
     bst.put([0, 1], 1)
     self.assertIsNone(bst.ceiling([0, 2]))
コード例 #4
0
 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))
コード例 #5
0
 def test_ceiling_withEmptyBST_shouldReturnNone(self):
     bst = AVLTree()
     for i in range(200):
         self.assertIsNone(bst.ceiling(i))