From 964890b499eebaff369cc6ce8a0f0040112ce010 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 --- t/ClassSortRoutine_Dewey.t | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/t/ClassSortRoutine_Dewey.t b/t/ClassSortRoutine_Dewey.t index a2d3dc1..7a4d7f4 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"); -- 1.7.4.1