From 87eb8e71572f873da1486a073f26948d3479934a Mon Sep 17 00:00:00 2001 From: amillar Date: Thu, 20 Jun 2002 15:19:33 +0000 Subject: [PATCH] Test valid ISBN numbers in Input.pm --- t/Input.t | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ testKoha.pl | 21 ++++++++++++++++++++- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 t/Input.t diff --git a/t/Input.t b/t/Input.t new file mode 100644 index 0000000000..ecc454be3e --- /dev/null +++ b/t/Input.t @@ -0,0 +1,51 @@ +# $Id$ + +#use strict; + +BEGIN { $| = 1; print "1..13\n"; } +END {print "not ok 1\n" unless $loaded;} +use C4::Input; +$loaded = 1; +print "ok 1\n"; + +my $TestCount=1; + +#----------------- +# Test ISBN validation + +my $isbn; + +# Good numbers +foreach $isbn ('0836213092','087784805X','087784805x','1878685899') { + PrintNextTestResult ( &checkvalidisbn($isbn), "Good ISBN: $isbn" ) +} + +# Bad numbers +foreach $isbn ('0836213192','087784804X','087784806x','1878685898', + '', ' ', 'abc', '1234567890123') { + PrintNextTestResult ( ! &checkvalidisbn($isbn), "Bad ISBN: $isbn" ) +} + + + +#----------------------- +sub PrintNextTestResult { + # modifies global var $TestCount + my ($ThisTestResult, $TestComment )=@_; + + $TestCount++; + + if ( $ThisTestResult ) { + print "ok $TestCount\n"; + } else { + print STDERR "\nTest failed: $TestComment\n"; + print "not ok $TestCount\n"; + } + +} # sub PrintNextTestResult + +#----------------------- +# $Log$ +# Revision 1.1.2.1 2002/06/20 15:19:34 amillar +# Test valid ISBN numbers in Input.pm +# diff --git a/testKoha.pl b/testKoha.pl index 2a1e109c70..eaf28dc66c 100644 --- a/testKoha.pl +++ b/testKoha.pl @@ -1,8 +1,27 @@ #!/usr/bin/perl -w +# $Id$ + use strict; use Test::Harness; # please add many tests here -runtests ('t/format.t', 't/koha.t', 't/output.t', 't/require.t'); +# Please make the test name the same as the module name where possible + +my @tests=( + 't/format.t', + 't/Input.t', + 't/koha.t', + 't/output.t', + 't/require.t', +); + + +runtests (@tests); + +exit; +# $Log$ +# Revision 1.1.2.7 2002/06/20 15:19:33 amillar +# Test valid ISBN numbers in Input.pm +# -- 2.39.5