Koha/t/ClassSortRoutine_Dewey.t
Jason Etheridge bce45b4bf5 Bug 9770: test case for sorting of Dewey call numbers that contain prefixes
This adds a test for C4::ClassSortRoutine::Dewey to check that the
call number "JR DVD 800.1" sorts before "JR DVD 900"

To test:

[1] Apply just this patch.
[1] Run prove -v t/ClassSortRoutine_Dewey.t
[2] Test #7 should fail.

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes test plan and QA script.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-15 16:12:47 +00:00

32 lines
1.1 KiB
Perl
Executable file

#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 7;
BEGIN {
use_ok('C4::ClassSortRoutine::Dewey');
}
my $cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key(undef, undef );
is($cn_sort,"","testing whitespace");
$cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key("....",".....");
is($cn_sort,"","testing fullstops");
$cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key("123","456");
is($cn_sort,"123_456000000000000","testing numbers");
$cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key("abc123","456");
is($cn_sort,"ABC_123_456000000000000","testing alphanumeric");
$cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key("ab c123","45 6");
is($cn_sort,"AB_C123_45_600000000000000","testing middle whitespace");
$cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key("YR DVD 800.1","");
my $cn_sort2 = C4::ClassSortRoutine::Dewey::get_class_sort_key("YR DVD 900","");
ok( $cn_sort lt $cn_sort2, "testing prefix plus decimal" );