Debian Codegraph @

t/rt/29089.t

raw
1 # $Revision: 1.1 $
2 use strict;
3
4 use Test::More 'no_plan';
5
6 use Business::ISBN qw(:all);
7
8 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
9 # parse a bunch of good ones
10 SKIP:
11 {
12 my $file = "isbn13s.txt";
13
14 open FILE, $file or
15 skip( "Could not read $file: $!", 1, "Need $file");
16
17 diag "\nChecking ISBN13s... (this may take a bit)\n";
18
19 my $bad = 0;
20 while( <FILE> )
21 {
22 chomp;
23 my $isbn = Business::ISBN->new( $_ );
24
25 my $result = $isbn->is_valid;
26 my $text = $Business::ISBN::ERROR_TEXT{ $result };
27
28 $bad++ unless $result eq Business::ISBN::GOOD_ISBN;
29 diag "$_ is not valid? [ $result -> $text ]\n"
30 unless $result eq Business::ISBN::GOOD_ISBN;
31 }
32
33 close FILE;
34
35 ok( $bad == 0, "Match good ISBNs" );
36 }