Exemplo n.º 1
0
 def test_13(self):
     """SCHeap.test_13(): __str__() need() spanning block when single block in list."""
     #print()
     self._sch.add(100, 400)
     #print(list(self._sch.genBlocks()))
     self.assertEqual([
         SCHeap.Block(50, 100),
         SCHeap.Block(400, 450),
     ], self._sch.need(50, 450))
Exemplo n.º 2
0
 def test_17(self):
     """SCHeap.test_17(): __str__() need() leading + trailing block when overlapping first of two blocks in list."""
     #print()
     self._sch.add(100, 200)
     self._sch.add(300, 400)
     #print(list(self._sch.genBlocks()))
     self.assertEqual([
         SCHeap.Block(50, 100),
         SCHeap.Block(200, 250),
     ], self._sch.need(50, 250))
Exemplo n.º 3
0
 def test_16(self):
     """SCHeap.test_16(): __str__() need() intermediate + trailing block when two blocks in list."""
     #print()
     self._sch.add(100, 200)
     self._sch.add(300, 400)
     #print(list(self._sch.genBlocks()))
     self.assertEqual([
         SCHeap.Block(200, 300),
         SCHeap.Block(400, 450),
     ], self._sch.need(150, 450))
Exemplo n.º 4
0
 def test_15(self):
     """SCHeap.test_15(): __str__() need() leading + intermediate block when two blocks in list."""
     #print()
     self._sch.add(100, 200)
     self._sch.add(300, 400)
     #print(list(self._sch.genBlocks()))
     self.assertEqual([
         SCHeap.Block(50, 100),
         SCHeap.Block(200, 300),
     ], self._sch.need(50, 350))
Exemplo n.º 5
0
 def test_05(self):
     """SCHeap.test_05(): __str__() add() two adjacent blocks, order reversed."""
     #print()
     self._sch.add(470, 900)
     self._sch.add(123, 470)
     #print(list(self._sch.genBlocks()))
     self.assertEqual([
         (False, SCHeap.Block(0, 123)),
         (True, SCHeap.Block(123, 900)),
     ], list(self._sch.genBlocks()))
Exemplo n.º 6
0
 def test_01(self):
     """SCHeap.test_01(): __str__() single add()."""
     self._sch.add(123, 470)
     str(self._sch)
     #print()
     #print(list(self._sch.genBlocks()))
     self.assertEqual([
         (False, SCHeap.Block(0, 123)),
         (True, SCHeap.Block(123, 470)),
     ], list(self._sch.genBlocks()))
Exemplo n.º 7
0
 def test_06(self):
     """SCHeap.test_06(): __str__() add() two separate blocks then filled."""
     #print()
     self._sch.add(123, 470)
     self._sch.add(500, 970)
     #print(list(self._sch.genBlocks()))
     self._sch.add(470, 500)
     #print(list(self._sch.genBlocks()))
     self.assertEqual([
         (False, SCHeap.Block(0, 123)),
         (True, SCHeap.Block(123, 970)),
     ], list(self._sch.genBlocks()))
Exemplo n.º 8
0
 def test_03(self):
     """SCHeap.test_03(): __str__() add() two separate blocks, order reversed."""
     self._sch.add(500, 970)
     self._sch.add(123, 470)
     #print()
     #print(list(self._sch.genBlocks()))
     self.assertEqual([
         (False, SCHeap.Block(0, 123)),
         (True, SCHeap.Block(123, 470)),
         (False, SCHeap.Block(470, 500)),
         (True, SCHeap.Block(500, 970)),
     ], list(self._sch.genBlocks()))
Exemplo n.º 9
0
 def test_10(self):
     """SCHeap.test_10(): __str__() need() on empty list."""
     #print()
     #print(list(self._sch.genBlocks()))
     self.assertEqual([
         SCHeap.Block(150, 670),
     ], self._sch.need(150, 670))
Exemplo n.º 10
0
 def setUp(self):
     """Set up."""
     self._sch = SCHeap.SCHeap()
Exemplo n.º 11
0
 def setUp(self):
     """Set up."""
     self._sch = SCHeap.SCHeap()
     random.seed()
Exemplo n.º 12
0
 def test_12(self):
     """SCHeap.test_12(): __str__() need() trailing block when single block in list."""
     self._sch.add(100, 400)
     self.assertEqual([
         SCHeap.Block(400, 450),
     ], self._sch.need(150, 450))
Exemplo n.º 13
0
 def test_11(self):
     """SCHeap.test_11(): __str__() need() leading block when single block in list."""
     self._sch.add(100, 400)
     self.assertEqual([
         SCHeap.Block(50, 100),
     ], self._sch.need(50, 170))