From f053ca0c22fdc0429fdcb1a7a67fde6171c971a9 Mon Sep 17 00:00:00 2001 From: Connor Dewar Date: Tue, 17 Jan 2012 14:32:29 +1300 Subject: [PATCH] Bug 5327 Added unit tests for C4/ClassSortRoutine/Dewey.pm Signed-off-by: Chris Cormack --- t/ClassSortRoutine_Dewey.t | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/t/ClassSortRoutine_Dewey.t b/t/ClassSortRoutine_Dewey.t index a2d3dc1681..7a4d7f4e4c 100755 --- a/t/ClassSortRoutine_Dewey.t +++ b/t/ClassSortRoutine_Dewey.t @@ -6,9 +6,23 @@ use strict; use warnings; -use Test::More tests => 1; +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"); -- 2.39.5