Test valid ISBN numbers in Input.pm
This commit is contained in:
parent
f9a1ee5564
commit
87eb8e7157
|
|
@ -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
|
||||
#
|
||||
21
testKoha.pl
21
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
|
||||
#
|
||||
|
|
|
|||
Loading…
Reference in New Issue