Lines 6-12
Link Here
|
6 |
use strict; |
6 |
use strict; |
7 |
use warnings; |
7 |
use warnings; |
8 |
|
8 |
|
9 |
use Test::More tests => 9; |
9 |
use Test::More tests => 10; |
10 |
|
10 |
|
11 |
BEGIN { |
11 |
BEGIN { |
12 |
use_ok('C4::ClassSortRoutine::LCC'); |
12 |
use_ok('C4::ClassSortRoutine::LCC'); |
Lines 25-27
is(C4::ClassSortRoutine::LCC::get_class_sort_key(' ',' '), "", "Arguments ' '
Link Here
|
25 |
is(C4::ClassSortRoutine::LCC::get_class_sort_key('.','b'), "_B", "Arguments '.','b' return '_B'"); |
25 |
is(C4::ClassSortRoutine::LCC::get_class_sort_key('.','b'), "_B", "Arguments '.','b' return '_B'"); |
26 |
is(C4::ClassSortRoutine::LCC::get_class_sort_key('....','........'), "_______", "Arguments '....','........' return '_______'"); |
26 |
is(C4::ClassSortRoutine::LCC::get_class_sort_key('....','........'), "_______", "Arguments '....','........' return '_______'"); |
27 |
is(C4::ClassSortRoutine::LCC::get_class_sort_key('.','.'), "__", "Arguments '.','.' return '__'"); |
27 |
is(C4::ClassSortRoutine::LCC::get_class_sort_key('.','.'), "__", "Arguments '.','.' return '__'"); |
28 |
- |
28 |
|
|
|
29 |
# list of example call numbers -- these |
30 |
# are intentionally in the _reverse_ of |
31 |
# the correct sort order |
32 |
my @call_numbers = ( |
33 |
'SB410.9 .P26 1993', |
34 |
'SB410.A26 I75 2000', |
35 |
'QC995 .E29 1997', |
36 |
'QC145.45 .H4 D65 1998', |
37 |
'QC145 .A57 V.12 1980', |
38 |
'QC100 .U57 NO. 555 1986', |
39 |
); |
40 |
|
41 |
my @sorted_call_numbers = map { $_->{call_number} } |
42 |
sort { $a->{sortkey} cmp $b->{sortkey} } |
43 |
map { { call_number => $_, sortkey => C4::ClassSortRoutine::LCC::get_class_sort_key($_, '') } } |
44 |
@call_numbers; |
45 |
is_deeply(\@sorted_call_numbers, [ reverse @call_numbers ], 'LC call numbers sorted in correct order'); |