File: valid_isbn_checksum.t

package info (click to toggle)
libbusiness-isbn-perl 3.003-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,412 kB
  • ctags: 89
  • sloc: perl: 647; makefile: 7
file content (19 lines) | stat: -rw-r--r-- 578 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl
use strict;
use warnings;

use Test::More 'no_plan';

require_ok( 'Business::ISBN' );

ok( defined &Business::ISBN::valid_isbn_checksum, "Defined in module" );

Business::ISBN->import( 'valid_isbn_checksum' );

ok( defined &valid_isbn_checksum, "Defined in main" );

is( valid_isbn_checksum( '0596527241'    ), 1, "Good ISBN10 passes" );
is( valid_isbn_checksum( '9780596527242' ), 1, "Good ISBN13 passes" );

is( valid_isbn_checksum( '059652724X'    ), 0, "Bad ISBN10 fails (good)" );
is( valid_isbn_checksum( '9780596527243' ), 0, "Bad ISBN13 fails (good)" );