Advertisement
IvetValcheva

Test 21

Dec 8th, 2022
496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. import org.junit.Assert;
  2. import org.junit.Test;
  3.  
  4. import java.util.ArrayList;
  5. import java.util.List;
  6.  
  7. public class TestRank_withValue_lowerThanLowest_returnZero {
  8.  
  9.     @Test
  10.     public void testRank_withValue_lowerThanLowest_returnZero() {
  11.         BinarySearchTree<Integer> bst = new BinarySearchTree<>();
  12.  
  13.         bst.insert(12);
  14.         bst.insert(21);
  15.         bst.insert(5);
  16.         bst.insert(8);
  17.         bst.insert(1);
  18.         bst.insert(18);
  19.         bst.insert(23);
  20.  
  21.         Assert.assertEquals(7, bst.count());
  22.  
  23.         int rank = bst.rank(-1);
  24.         Assert.assertEquals(0, rank);
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement