Skip to content

Commit

Permalink
maybe fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
benmaier committed Jul 3, 2021
1 parent 9cc75fa commit eb7b727
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
13 changes: 11 additions & 2 deletions binpacking/tests/constant_bin_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,31 @@ def test_bounds_and_tuples():
N_bin = 4

bins = to_constant_bin_number(c,N_bin,weight_pos=1,upper_bound=11)
bins = [ sorted(_bin, key=lambda x:x[0]) for _bin in bins ]
assert bins == [
[('a', 10, 'foo')],
[('b', 10, 'log')],
[('f', 7, 'floggo')],
[('e', 2, 'bommel'), ('d', 1, 'bar')]
[
('d', 1, 'bar'),
('e', 2, 'bommel'),
]
]

bins = to_constant_bin_number(c,N_bin,weight_pos=1,lower_bound=1)
bins = [ sorted(_bin, key=lambda x:x[0]) for _bin in bins ]
assert bins == [
[('c', 11,)],
[('a', 10, 'foo')],
[('b', 10, 'log')],
[('f', 7, 'floggo'), ('e', 2, 'bommel')],
[
('e', 2, 'bommel'),
('f', 7, 'floggo'),
],
]

bins = to_constant_bin_number(c,N_bin,weight_pos=1,lower_bound=1,upper_bound=11)
bins = [ sorted(_bin, key=lambda x:x[0]) for _bin in bins ]
assert bins == [
[('a', 10, 'foo')],
[('b', 10, 'log')],
Expand Down
19 changes: 16 additions & 3 deletions binpacking/tests/constant_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,37 @@ def test_bounds_and_tuples():
V_max = 11

bins = to_constant_volume(c,V_max,weight_pos=1,upper_bound=11)
bins = [ sorted(_bin, key=lambda x:x[0]) for _bin in bins ]
assert bins == [
[('a', 10, 'foo'), ('d', 1, 'bar')],
[('b', 10, 'log')], [('f', 7, 'floggo'), ('e', 2, 'bommel')],
[('b', 10, 'log')],
[
('e', 2, 'bommel'),
('f', 7, 'floggo'),
],
]

bins = to_constant_volume(c,V_max,weight_pos=1,lower_bound=1)
bins = [ sorted(_bin, key=lambda x:x[0]) for _bin in bins ]
assert bins == [
[('c', 11,)],
[('a', 10, 'foo')],
[('b', 10, 'log')],
[('f', 7, 'floggo'), ('e', 2, 'bommel')],
[
('e', 2, 'bommel'),
('f', 7, 'floggo'),
],
]

bins = to_constant_volume(c,V_max,weight_pos=1,lower_bound=1,upper_bound=11)
bins = [ sorted(_bin, key=lambda x:x[0]) for _bin in bins ]
assert bins == [
[('a', 10, 'foo')],
[('b', 10, 'log')],
[('f', 7, 'floggo'), ('e', 2, 'bommel')],
[
('e', 2, 'bommel'),
('f', 7, 'floggo'),
],
]


Expand Down

0 comments on commit eb7b727

Please sign in to comment.