Esempio n. 1
0
 def test_writeModificationsFromSameBundle0(self):
   bundle = Modifications()
   add0 = Addition(11, "1", "me")
   add1 = Addition(12, "2", "me")
   add2 = Addition(13, "3", "me")
   bundle.extend([add0,add1,add2])
   self.zone.add(bundle)
   self.zone.writeModifications()
   self.assertEqual(self.zone.content, "Hello World123")
Esempio n. 2
0
 def test_writeTwoBundles1(self):
   bundle = Modifications()
   add0 = Addition(11, "1", "me")
   add1 = Addition(12, "2", "me")
   add2 = Addition(13, "3", "me")
   bundle.extend([add0,add1,add2])
   self.zone.add(self.removal1)
   self.zone.add(bundle)
   self.zone.writeModifications()
   self.assertEqual(self.zone.content, "123")
Esempio n. 3
0
 def test_returnedVectorSameModifications(self):
   additionSame = Addition(self.addition1)
   self.assertEqual(additionSame.position, self.addition1.position)
   self.zone.add(self.addition1)
   self.zone.add(additionSame)
   _,modifications = self.zone.writeModifications()
   self.assertEqual(len(modifications), 2)
   self.assertEqual(modifications[0].position, 6)
   self.assertEqual(modifications[1].position, 10)
Esempio n. 4
0
class TestAjout(TestCase):
    def setUp(self):
        self.file = File("test")
        self.addition = Addition(2, 4, "allo", "me")

    def tearDown(self):
        pass

    def test_getPosition(self):
        self.assertEqual(self.addition.position, 2)

    def test_getTaille(self):
        self.assertEqual(self.addition.size, 4)

    def test_effectuer(self):
        self.addition.apply(self.file)
        self.assertEqual(self.file.content, "teallost")

    def test_mettreAJour(self):
        modification = Removal(1, 3, "me")
        self.addition.update(modification)
        self.assertEqual(self.addition.position, 1)

    def test_getData(self):
        self.assertEqual(self.addition.data, "allo")

    def test_isAdd(self):
        self.assertTrue(self.addition.isAdd())

    def test_isRemove(self):
        self.assertFalse(self.addition.isRemove())
Esempio n. 5
0
 def setUp(self):
     self.addition1 = Addition(0, 5, "Hello", "me")
     self.addition2 = Addition(4, 3, "123", "me")
     self.addition3 = Addition(6, 5, "World", "me")
     self.addition4 = Addition(6, 5, "monde", "me")
     self.zone = TransitZone("Hello ")
Esempio n. 6
0
 def setUp(self):
   self.addition1 = Addition(6, 4, "allo", "me")
   self.removal1 = Removal(0, 11, "me")
   self.removal2 = Removal(6, 5, "me")
   self.addition2 = Addition(6, 5, "monde", "me")
   self.zone = TransitZone("Hello World")
Esempio n. 7
0
 def test_add(self):
   self.zone.add(self.addition1)
   self.zone.add(Addition(0, "test", "me"))
   self.assertFalse(self.zone.isEmpty())
Esempio n. 8
0
 def setUp(self):
     self.file = File("test")
     self.addition = Addition(2, 4, "allo", "me")
Esempio n. 9
0
 def test_addAndDeleteSamePosition1(self):
     add = Addition(6, "123", "me")
     self.zone.add(add)
     self.zone.add(self.removal)
     self.zone.writeModifications()
     self.assertEqual(self.zone.content, "Hello 123")
Esempio n. 10
0
 def test_addBeforeDelete1(self):
     add = Addition(2, "123", "me")
     self.zone.add(self.removal)
     self.zone.add(add)
     self.zone.writeModifications()
     self.assertEqual(self.zone.content, "He123llo ")
Esempio n. 11
0
 def test_deleteBeforeAdd_NoOverlaps1(self):
     add = Addition(11, "!", "me")
     self.zone.add(add)
     self.zone.add(self.removal)
     self.zone.writeModifications()
     self.assertEqual(self.zone.content, "Hello !")
Esempio n. 12
0
 def test_deletBeforeAdd_Overlaps1(self):
     add = Addition(7, "123", "me")
     self.zone.add(add)
     self.zone.add(self.removal)
     self.zone.writeModifications()
     self.assertEqual(self.zone.content, "Hello rld")
Esempio n. 13
0
 def test_update(self):
     modification = Addition(0, 5, "allo ", "me")
     self.removal.update(modification)
     self.assertEqual(self.removal.position, 7)