]> git.koha-community.org Git - koha.git/blob - t/ClassSortRoutine_Dewey.t
Bug 17431: Remove use of C4::Items and C4::Biblio
[koha.git] / t / ClassSortRoutine_Dewey.t
1 #!/usr/bin/perl
2 #
3 # This Koha test module is a stub!  
4 # Add more tests here!!!
5
6 use strict;
7 use warnings;
8
9 use Test::More tests => 10;
10
11 BEGIN {
12         use_ok('C4::ClassSortRoutine::Dewey');
13 }
14
15 my $cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key(undef, undef );
16 is($cn_sort,"","testing whitespace");
17
18 $cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key("....",".....");
19 is($cn_sort,"","testing fullstops");
20
21 $cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key("123","456");
22 is($cn_sort,"123_456000000000000","testing numbers");
23
24 $cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key("abc123","456");
25 is($cn_sort,"ABC_123_456000000000000","testing alphanumeric");
26
27 $cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key("ab         c123","45   6");
28 is($cn_sort,"AB_C123_45_600000000000000","testing middle whitespace");
29
30 $cn_sort     = C4::ClassSortRoutine::Dewey::get_class_sort_key("YR DVD 800.1","");
31 my $cn_sort2 = C4::ClassSortRoutine::Dewey::get_class_sort_key("YR DVD 900","");
32 ok( $cn_sort lt $cn_sort2, "testing prefix plus decimal" );
33
34 $cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key("971/P23w/v.1-2/pt.8","");
35 is($cn_sort,"971_000000000000000_P23W_V_12_PT_8", "Test 1 for bug 8836");
36
37 $cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key("971.01 P23w v.1-2 pt.6-7","");
38 is($cn_sort,"971_010000000000000_P23W_V_12_PT_67", "Test 2 for bug 8836");
39
40 $cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key("971.01 P23w v.1-2 pt.7","");
41 is($cn_sort,"971_010000000000000_P23W_V_12_PT_7", "Test 3 for bug 8836");