コード例 #1
0
ファイル: binpack.py プロジェクト: darnir/schedcat
 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
ファイル: binpack.py プロジェクト: darnir/schedcat
 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
ファイル: binpack.py プロジェクト: zhangtong1516/schedcat
 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
ファイル: binpack.py プロジェクト: zhangtong1516/schedcat
 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)