Bug 41959: Unit tests
This adds a test for the condition where there are 2 holds, 1 item, and the item cannot fulfill the first hold
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
(cherry picked from commit 890ce7cc49)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
This commit is contained in:
parent
7e2e87f5ec
commit
8393eeec63
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 120;
|
||||
use Test::More tests => 123;
|
||||
use Test::NoWarnings;
|
||||
use Test::Warn;
|
||||
use Data::Dumper;
|
||||
|
|
@ -193,7 +193,10 @@ sub test_allocation {
|
|||
if ($expected_allocation) {
|
||||
my @indices = allocation_indices( $libraries, $holds_queue );
|
||||
|
||||
is( scalar(@indices), scalar(@$expected_allocation), "$label correct number of allocations" );
|
||||
is(
|
||||
scalar(@indices), scalar(@$expected_allocation),
|
||||
"$label correct number of allocations (" . scalar @$expected_allocation . ")"
|
||||
);
|
||||
|
||||
# print STDERR Dumper(\@indices);
|
||||
|
||||
|
|
@ -349,6 +352,21 @@ test_allocation(
|
|||
2
|
||||
);
|
||||
|
||||
test_allocation(
|
||||
"more holds than items and items cannot fill all holds",
|
||||
[
|
||||
[ 0, 1, 1, -1, 1 ],
|
||||
[ -1, 0, -1, -1, 1 ],
|
||||
[ -1, -1, 0, -1, -1 ],
|
||||
[ -1, -1, -1, 0, -1 ],
|
||||
[ -1, -1, -1, -1, 0 ]
|
||||
],
|
||||
[ 1, 0, 0, 0, 0 ],
|
||||
[ 0, 0, 0, 1, 1 ],
|
||||
[ [ 0, 4 ] ],
|
||||
1
|
||||
);
|
||||
|
||||
test_allocation(
|
||||
"large volume",
|
||||
[
|
||||
|
|
|
|||
Loading…
Reference in New Issue