1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'
#########################
# change 'tests => 1' to 'tests => last_test_to_print';
use vars qw(@testcases);
use Test;
BEGIN {
do 't/valid.data';
plan(tests => ($#testcases + 1) * 5
# ,todo => [ 76, ]
);
};
use Algorithm::CheckDigits;
my $checkdigit;
foreach my $tcase (@testcases) {
#foreach my $tcase ($testcases[$#testcases]) {
if ($checkdigit = CheckDigits($tcase->[0])) {
my $is_valid = $checkdigit->is_valid($tcase->[1]);
ok($is_valid
,1
,"is_valid $tcase->[0]"
);
my $skip = not $is_valid;
skip($skip
,$checkdigit->complete($tcase->[2])
,$tcase->[1]
,"complete $tcase->[0]"
);
skip($skip
,$checkdigit->basenumber($tcase->[1])
,$tcase->[2]
,"basenumber $tcase->[0]"
);
skip($skip
,$checkdigit->checkdigit($tcase->[1])
,$tcase->[3]
,"checkdigit $tcase->[0]"
);
skip($skip
,(not $checkdigit->is_valid($tcase->[4]))
,1
,"not is_valid $tcase->[0]: $tcase->[4]"
);
}
}
#########################
# Insert your test code below, the Test module is use()ed here so read
# its man page ( perldoc Test ) for help writing this test script.
|