bug 6281: add test case for sorting LC call numbers correctly
My thanks to Michael Flanagan of UCAR for providing some of these examples. Signed-off-by: Galen Charlton <gmc@esilibrary.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Galen Charlton <gmc@esilibrary.com> (cherry picked from commit87ab820a20) Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> (cherry picked from commitcee5651e11) Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> (cherry picked fromcee5651e11) Signed-off-by: Chris Hall <followingthepath@gmail.com> (cherry picked from0f6bff1348)
This commit is contained in:
parent
824932abd9
commit
8d1bb2521f
|
|
@ -6,7 +6,7 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More tests => 9;
|
||||
use Test::More tests => 10;
|
||||
|
||||
BEGIN {
|
||||
use_ok('C4::ClassSortRoutine::LCC');
|
||||
|
|
@ -25,3 +25,21 @@ is(C4::ClassSortRoutine::LCC::get_class_sort_key(' ',' '), "", "Arguments ' '
|
|||
is(C4::ClassSortRoutine::LCC::get_class_sort_key('.','b'), "_B", "Arguments '.','b' return '_B'");
|
||||
is(C4::ClassSortRoutine::LCC::get_class_sort_key('....','........'), "_______", "Arguments '....','........' return '_______'");
|
||||
is(C4::ClassSortRoutine::LCC::get_class_sort_key('.','.'), "__", "Arguments '.','.' return '__'");
|
||||
|
||||
# list of example call numbers -- these
|
||||
# are intentionally in the _reverse_ of
|
||||
# the correct sort order
|
||||
my @call_numbers = (
|
||||
'SB410.9 .P26 1993',
|
||||
'SB410.A26 I75 2000',
|
||||
'QC995 .E29 1997',
|
||||
'QC145.45 .H4 D65 1998',
|
||||
'QC145 .A57 V.12 1980',
|
||||
'QC100 .U57 NO. 555 1986',
|
||||
);
|
||||
|
||||
my @sorted_call_numbers = map { $_->{call_number} }
|
||||
sort { $a->{sortkey} cmp $b->{sortkey} }
|
||||
map { { call_number => $_, sortkey => C4::ClassSortRoutine::LCC::get_class_sort_key($_, '') } }
|
||||
@call_numbers;
|
||||
is_deeply(\@sorted_call_numbers, [ reverse @call_numbers ], 'LC call numbers sorted in correct order');
|
||||
|
|
|
|||
Loading…
Reference in New Issue