Example #1
0
    def test_C(self):
        l = DLlist()
        l.push_back(1)
        l.push_back(2)
        l.delete(0)

        self.assertTrue(len(l) == 1)
Example #2
0
    def test_F(self):
        l = DLlist()
        l.push_back(1)
        l.push_back(2)
        l.push_back(3)
        l.delete(1)

        self.assertTrue(len(l) == 2)
Example #3
0
    def test_K(self):
        l1 = DLlist()
        for i in range(0, 0x100):
            l1.push_back(str(i))
        
        assert len(l1) == 0x100

        for i in range(0x100-1, -1, -1):
            l1.delete(i)

        self.assertTrue(len(l1) == 0x0)
Example #4
0
    def test_S(self):
        l = DLlist()
        l.push_back(1)
        l.delete(0)
        l.push_back('A')
        l.push_back('B')
        l.push_back('C')
        l.push_back('D')

        self.assertTrue(len(l) == 4 and
                        l[0] == 'A' and
                        l[1] == 'B' and
                        l[2] == 'C' and
                        l[3] == 'D')