/[Lingua-Spelling-Alternative]/test.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /test.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Mon Feb 11 20:19:59 2002 UTC (20 years, 11 months ago) by dpavlin
Branch: MAIN
Changes since 1.2: +22 -2 lines
File MIME type: text/plain
support for output from loadaffix

1 dpavlin 1.1 #!perl -w
2    
3     use strict;
4    
5     # init some vars
6     my $affix_file='/usr/lib/ispell/english.aff';
7     my @test_words=( 'cars', 'dogs' );
8    
9 dpavlin 1.3 my $findaffix_file='./findaffix.out';
10    
11 dpavlin 1.1 my $loaded = 0;
12    
13 dpavlin 1.3 BEGIN { $| = 1; print "1..6\n"; }
14 dpavlin 1.1 END {print "not ok 1\n" unless $loaded;}
15    
16     use Lingua::Spelling::Alternative;
17     $loaded = 1;
18     print "ok 1\n";
19    
20     ### test constructor
21    
22 dpavlin 1.2 my $a = new Lingua::Spelling::Alternative( DEBUG => 1 ) ;
23 dpavlin 1.1
24     defined($a) || print 'not '; print "ok 2\n";
25    
26     ### test load affix
27    
28     if ( -e $affix_file ) {
29     my $ok = $a->load_affix($affix_file);
30     print 'not ' if (! $ok);
31     print "ok 3\n";
32    
33     my @words = $a->alternatives(@test_words);
34     print 'not ' if (! @words);
35     print "ok 4 # - ",join(", ",@test_words)," -> ",join(", ",@words),"\n";
36     } else {
37     print "ok 3 # - Skip, affix file '$affix_file' not found\n";
38     print "ok 4 # - Skip\n";
39 dpavlin 1.3 }
40    
41     undef $a;
42    
43     ### test load findaffix
44    
45     if ( -e $findaffix_file ) {
46     my $a = new Lingua::Spelling::Alternative( DEBUG => 1 ) ;
47    
48     my $ok = $a->load_findaffix($findaffix_file);
49     print 'not ' if (! $ok);
50     print "ok 5\n";
51    
52     my @words = $a->alternatives(@test_words);
53     print 'not ' if (! @words);
54     print "ok 6 # - ",join(", ",@test_words)," -> ",join(", ",@words),"\n";
55     } else {
56     print "ok 5 # - Skip, findaffix file '$findaffix_file' not found\n";
57     print "ok 6 # - Skip\n";
58 dpavlin 1.1 }
59    

  ViewVC Help
Powered by ViewVC 1.1.26