Beispiel #1
0
    def test_findMid_m3_odd(self):
        #arrange
        sll = SLL()
        for i in range(5):
            sll.insert(i)

        #act - assert
        self.assertEqual(2, findMid_m3(sll.head))
Beispiel #2
0
    def test_findMid_m2_even(self):
        #arrange
        sll = SLL()
        for i in range(6):
            sll.insert(i)

        #act - assert
        self.assertEqual(3, findMid_m2(sll.head))
Beispiel #3
0
    def test_insert_on_empty_list(self):
        #arrange
        sll = SLL()

        #act
        sll.insert(1)

        #assert
        self.assertEqual(sll.head.data, 1)
        self.assertEqual(sll.tail, sll.head)
Beispiel #4
0
    def test_insert_at_begining_on_nonempty_list(self):
        #arrange
        sll = SLL()
        for i in range(3):
            sll.insert(i)

        #act
        sll.insert_at_begining(4)

        #assert
        self.assertEqual(4, sll.head.data)
Beispiel #5
0
    def test_insert_on_nonempty_list(self):
        #arrange
        sll = SLL()
        for i in range(3):
            sll.insert(i)

        #act
        sll.insert(4)

        #asser
        self.assertEqual(4, sll.tail.data)