Untitled
raw download clone
TEXT
views 60
,
size 1609 b
@DisplayName("Search in root")
    @Test
    fun testSearchInRoot() {

         Tree.insert(1, 1)

         assertEquals(Pair(1, 1), Tree.find(1))

     }

     @DisplayName("Search case 1")
    @Test
    fun testSearchCase1() {

         Tree.insert(1, 1)
        Tree.insert(2, 2)

         assertEquals(Pair(2, 2), Tree.find(2))
        assertEquals(Pair(1, 1), Tree.find(1))

     }

     @DisplayName("Search case 2")
    @Test
    fun testSearchCase2() {

         Tree.insert(2, 2)
        Tree.insert(1, 1)

         assertEquals(Pair(2, 2), Tree.find(2))
        assertEquals(Pair(1, 1), Tree.find(1))

     }

     @DisplayName("Search case 3")
    @Test
    fun testSearchCase3() {

         Tree.insert(1, 1)
        Tree.insert(2, 2)
        Tree.insert(3, 3)

         assertEquals(Pair(3, 3), Tree.find(3))
        assertEquals(Pair(2, 2), Tree.find(2))
        assertEquals(Pair(1, 1), Tree.find(1))

     }

     @DisplayName("Search case 4")
    @Test
    fun testSearchCase4() {

         Tree.insert(3, 3)
        Tree.insert(2, 2)
        Tree.insert(1, 1)

         assertEquals(Pair(3, 3), Tree.find(3))
        assertEquals(Pair(2, 2), Tree.find(2))
        assertEquals(Pair(1, 1), Tree.find(1))

     }


     @DisplayName("Search case 5")
    @Test
    fun testSearchCase5() {

         Tree.insert(2, 2)
        Tree.insert(3, 3)
        Tree.insert(1, 1)

         assertEquals(Pair(3, 3), Tree.find(3))
        assertEquals(Pair(2, 2), Tree.find(2))
        assertEquals(Pair(1, 1), Tree.find(1))

     }
close fullscreen
Login or Register to edit or fork this paste. It's free.