示例#1
0
 def test_next_fit_few(self):
     h = rb.NextFit(self.bins[:4])
     expected = [[8], [5], [7], [6, 2]]
     misfits = [4, 1]
     self.assertEqual(len(self.items) - len(misfits), h.binpack(self.items))
     did_part = [bin.items for bin in h.bins]
     self.assertEqual(expected, did_part)
     self.assertEqual(misfits, h.misfits)
示例#2
0
 def test_next_fit_small(self):
     h = rb.NextFit(make_bin=lambda: self.make_bin(7))
     expected = [[5], [7], [6], [2, 4, 1]]
     misfits = [8]
     self.assertEqual(len(self.items) - len(misfits), h.binpack(self.items))
     did_part = [bin.items for bin in h.bins]
     self.assertEqual(expected, did_part)
     self.assertEqual(misfits, h.misfits)
示例#3
0
 def test_next_fit_make(self):
     h = rb.NextFit(make_bin=lambda: self.make_bin(10))
     self.assertEqual(len(self.items), h.binpack(self.items))
     expected = [[8], [5], [7], [6, 2], [4, 1]]
     did_part = [bin.items for bin in h.bins]
     self.assertEqual(expected, did_part)
示例#4
0
 def test_next_fit_fixed(self):
     h = rb.NextFit(self.bins)
     self.assertEqual(len(self.items), h.binpack(self.items))
     expected = [[8], [5], [7], [6, 2], [4, 1]]
     did_part = [bin.items for bin in h.bins]
     self.assertEqual(expected, did_part)