push @must_exist, "fdt" if ($self->{read_fdt});
foreach my $ext (@must_exist) {
- confess "missing ",uc($ext)," file in ",$self->{isisdb} unless ($self->{$ext."_file"});
+ croak "missing ",uc($ext)," file in ",$self->{isisdb} unless ($self->{$ext."_file"});
}
print STDERR "## using files: ",join(" ",@isis_files),"\n" if ($self->{debug});
sub read_cnt {
my $self = shift;
- confess "missing CNT file in ",$self->{isisdb} unless ($self->{cnt_file});
+ croak "missing CNT file in ",$self->{isisdb} unless ($self->{cnt_file});
# Get the index information from $db.CNT
BEGIN { use_ok( 'IsisDB' ); }
my $object = IsisDB->new (
- isisdb => '/data/isis_data/ps/LIBRI/LIBRI',
+ isisdb => './data/winisis/BIBL',
);
isa_ok ($object, 'IsisDB');
--- /dev/null
+#!/usr/bin/perl -w
+
+use strict;
+use blib;
+
+use Data::Dumper;
+
+use Test::More tests => 28;
+
+BEGIN { use_ok( 'IsisDB' ); }
+
+my $isis;
+
+sub test_data {
+
+ isa_ok ($isis, 'IsisDB');
+
+ cmp_ok($isis->{maxmfn}, '==', 5, "maxmfn set to 5");
+
+ # test .CNT data
+
+ SKIP: {
+ skip "no CNT file for this database", 5 unless $isis->{cnt_file};
+
+ $isis->read_cnt;
+
+ my $cnt = {
+ '1' => {
+ 'N' => 15,
+ 'K' => 5,
+ 'FMAXPOS' => 8,
+ 'POSRX' => 1,
+ 'ABNORMAL' => 1,
+ 'ORDN' => 5,
+ 'LIV' => 0,
+ 'ORDF' => 5,
+ 'NMAXPOS' => 1
+ },
+ '2' => {
+ 'N' => 15,
+ 'K' => 5,
+ 'FMAXPOS' => 4,
+ 'POSRX' => 1,
+ 'ABNORMAL' => 0,
+ 'ORDN' => 5,
+ 'LIV' => 0,
+ 'ORDF' => 5,
+ 'NMAXPOS' => 1
+ }
+ };
+
+ foreach my $c (keys %{$cnt}) {
+ foreach my $kn (keys %{$cnt->{$c}}) {
+ cmp_ok($isis->{cnt}->{$c}->{$kn}, '==', $cnt->{$c}->{$kn}, "cnt $c $kn same");
+ }
+ }
+ }
+
+}
+
+$isis = IsisDB->new (
+ isisdb => './data/winisis/BIBL',
+);
+
+print Dumper($isis);
+
+test_data;
+
+$isis = IsisDB->new (
+ isisdb => './data/isismarc/BIBL',
+);
+
+test_data;