Exemplo n.º 1
0
    def test_C(self):
        l = DLlist()
        l.push_back(1)
        l.push_back(2)
        l.delete(0)

        self.assertTrue(len(l) == 1)
Exemplo n.º 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)
Exemplo n.º 3
0
    def test_Q(self):
        l1 = DLlist()
        l1.push_back(1)
        l1.push_back(2)

        l1[1] = 3

        self.assertTrue(l1[1] == 3)
Exemplo n.º 4
0
    def test_J(self):
        l1 = DLlist()
        l1.push_back(1)
        l1.push_back(2)
        l1.push_back(4)

        self.assertTrue(l1.front_insert(3, 2) == 4)
        self.assertTrue(len(l1) == 4)
Exemplo n.º 5
0
    def test_P(self):
        l1 = DLlist()
        l1.push_back(1)
        l1.push_back(2)

        l2 = l1
        l2.push_back(3)

        self.assertTrue(len(l1) == 3 and
                        len(l2) == 3 and
                        id(l1) == id(l2))
Exemplo n.º 6
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)
Exemplo n.º 7
0
    def test_R(self):
        l1 = DLlist()
        l1.push_back(1)
        l1.push_back(2)

        l2 = l1.copy()
        l2.push_back(3)

        self.assertTrue(len(l1) == 2 and
                        len(l2) == 3 and
                        id(l1) != id(l2) and
                        l1 != l2)
Exemplo n.º 8
0
    def test_A(self):
        l = DLlist()
        l.push_back(1)
        l.push_back(2)
        l.push_back(3)
        l.push_back(True)
        l.push_back('AAAA')

        self.assertTrue(l[2] == 3)
Exemplo n.º 9
0
    def test_I(self):
        l1 = DLlist()
        l1.push_back(1)
        l1.push_back(2)
        l1.push_back(3)

        l2 = DLlist()
        l2.push_back(1)
        l2.push_back(2)
        l2.push_back(3)

        self.assertTrue(l1 == l2)
Exemplo n.º 10
0
    def test_O(self):
        l1 = DLlist()
        l1.push_back(1)
        l1.push_back(3)
        l1.push_back(2)

        l2 = DLlist()
        l2.push_back(1)
        l2.push_back(2)
        l2.push_back(3)

        tmpdict = {l1 : 'AAAA', l2 : 'BBBB'}

        print(tmpdict[l1])
        print(tmpdict[l2])

        self.assertTrue(tmpdict[l1] == 'AAAA' and tmpdict[l2] == 'BBBB')
Exemplo n.º 11
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')