Koha/t/ClassSortRoutine_Dewey.t
Connor Dewar f053ca0c22 Bug 5327 Added unit tests for C4/ClassSortRoutine/Dewey.pm
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2012-01-17 15:31:55 +01:00

28 lines
852 B
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 => 6;
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");