/[wait]/cvs-head/t/wais.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /cvs-head/t/wais.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

branches/CPAN/t/wais.t revision 13 by ulpfr, Fri Apr 28 15:42:44 2000 UTC cvs-head/t/wais.t revision 63 by laperla, Mon Jan 14 23:29:20 2002 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl  #!/usr/bin/perl -w
2  #                              -*- Mode: Perl -*-  #                              -*- Mode: Perl -*-
3  # $Basename: wais.t $  # $Basename: wais.t $
4  # $Revision: 1.6 $  # $Revision: 1.14 $
5  # Author          : Ulrich Pfeifer  # Author          : Ulrich Pfeifer
6  # Created On      : Tue Dec 12 16:55:05 1995  # Created On      : Tue Dec 12 16:55:05 1995
7  # Last Modified By: Ulrich Pfeifer  # Last Modified By: Ulrich Pfeifer
8  # Last Modified On: Wed Nov 12 19:46:12 1997  # Last Modified On: Sat Nov 11 16:33:54 2000
9  # Language        : Perl  # Language        : Perl
10  # Update Count    : 157  # Update Count    : 187
11  # Status          : Unknown, Use with caution!  # Status          : Unknown, Use with caution!
12  #  #
13  # (C) Copyright 1997, Ulrich Pfeifer, all rights reserved.  # (C) Copyright 1997, Ulrich Pfeifer, all rights reserved.
# Line 18  use WAIT::Database; Line 18  use WAIT::Database;
18  use WAIT::Wais;  use WAIT::Wais;
19  use Cwd;  use Cwd;
20  use strict;  use strict;
21    use File::Path qw(mkpath rmtree);
22    
23  $SIG{__DIE__} = $SIG{INT} = \&cleanup;  $SIG{__DIE__} = $SIG{INT} = \&cleanup;
24    
25  my $pwd = getcwd();  my $pwd = getcwd();
26  print  "$^X -Iblib blib/script/bibdb -dir /tmp -database sample\n";  mkpath "/tmp/wait-test-$$";
27  system "$^X -Iblib blib/script/bibdb -dir /tmp -database sample > /dev/null 2>&1";  print  "$^X -Mblib blib/script/bibdb -dir /tmp/wait-test-$$ -database sample\n";
28    system "$^X -Mblib blib/script/bibdb -dir /tmp/wait-test-$$ -database sample > /dev/null 2>&1";
29    print "1..7\n";
30    
31    use Fcntl;
32    if (1) {
33      my $db = WAIT::Database->open(
34                                    name        => 'sample',
35                                    'directory' => "/tmp/wait-test-$$",
36                                    'mode'      => O_RDWR,
37                                   );
38      print "not " unless $db;
39      print "ok 1\n";
40      my $tb = $db->table(name => 'bibdb');
41      print "not " unless $tb;
42      print "ok 2\n";
43      
44      print "not " unless $tb->open;
45      print "ok 3\n";
46    
47  print "1..3\n";    print "not " unless $tb->set(top => 1);
48  my $db = '/tmp/sample/bibdb';    print "ok 4\n";
49    
50      $tb->close;
51      $db->close;
52    }
53    
54    
55    my $db = "/tmp/wait-test-$$/sample/bibdb";
56  print "# Testing WAIT searches\n";  print "# Testing WAIT searches\n";
57  my $result = WAIT::Wais::Search({  my $result = WAIT::Wais::Search({
58                                   'query'    => 'pfeifer',                                   'query'    => 'pfeifer',
# Line 35  my $result = WAIT::Wais::Search({ Line 61  my $result = WAIT::Wais::Search({
61    
62  &headlines($result);  &headlines($result);
63  my $id     = ($result->header)[9]->[6];  my $id     = ($result->header)[9]->[6];
64    # no strict order
65    $$id = "wait;/tmp/wait-test-$$/sample/bibdb;13";
66  #$length = ($result->header)[9]->[3];  #$length = ($result->header)[9]->[3];
67  my @header = $result->header;  my @header = $result->header;
68    
# Line 45  my $short = ($result->header)[0]->[6]; Line 73  my $short = ($result->header)[0]->[6];
73    
74  my $result_text = $result->text;  my $result_text = $result->text;
75  print $#header >= 14 ?  print $#header >= 14 ?
76      "ok 1\n" :      "ok 5\n" :
77      "#\$\#header[$#header]result_text[$result_text]\nnot ok 1\n";      "#\$\#header[$#header]result_text[$result_text]\nnot ok 5\n";
78    
79  print "# Testing local retrieve\n";  print "# Testing local retrieve\n";
80  $result = WAIT::Wais::Retrieve(  $result = WAIT::Wais::Retrieve(
# Line 58  $result = WAIT::Wais::Retrieve( Line 86  $result = WAIT::Wais::Retrieve(
86  $result_text = $result->text;  $result_text = $result->text;
87  $result_text =~ s/^/# /gm;  $result_text =~ s/^/# /gm;
88  print $result_text =~ m!Pfeifer/Fuhr:93! ?  print $result_text =~ m!Pfeifer/Fuhr:93! ?
89      "ok 2\n" :      "ok 6\n" :
90      "# result_text[$result_text]\nnot ok 2\n";      "# result_text[$result_text]\nnot ok 6\n";
91    
92  my @x = $short->split;  my @x = $short->split;
93  print $x[2] =~ /test.ste 3585 393$/ || $x[2] == 1 ?  print $x[2] =~ /test.ste 3585 393$/ || $x[2] == 1 ?
94      "ok 3\n" :      "ok 7\n" :
95      "# \@x:[@x]\nnot ok 3\n";      "# \@x:[@x]\nnot ok 7\n";
96    
97    
98  #######################################################################  #######################################################################
# Line 80  sub headlines { Line 108  sub headlines {
108      }      }
109  }  }
110    
111    # releasing 1 pending lock... at .../LockFile/Simple.pm
112    open STDERR, '>/dev/null';
113    
114  sub cleanup  sub cleanup
115  {  {
116    system 'rm -rf /tmp/sample';    rmtree "/tmp/wait-test-$$";
117  }  }
118    
119    

Legend:
Removed from v.13  
changed lines
  Added in v.63

  ViewVC Help
Powered by ViewVC 1.1.26