3 # $Id: soundex.t,v 1.2 1994/03/24 00:30:27 mike Exp $
5 # test module for soundex.pl
8 # Revision 1.2 1994/03/24 00:30:27 mike
9 # Subtle bug (any excuse :-) spotted by Rich Pinder <rpinder@hsc.usc.edu>
10 # in the way I handles leasing characters which were different but had
11 # the same soundex code. This showed up comparing it with Oracle's
14 # Revision 1.1 1994/03/02 13:03:02 mike
40 ($try = $_) =~ s/^eval\s+//;
46 print "not ok $test\n";
47 print "# eval '$try' returned $@";
52 ($in, $out) = split (':');
54 $try = "\@expect = $out; \@got = &soundex $in;";
60 print "not ok $test\n";
61 print "# expected ", scalar @expect, " results, got ", scalar @got, "\n";
62 print "# expected (", join (', ', @expect),
63 ") got (", join (', ', @got), ")\n";
69 $expect = shift @expect;
75 print "not ok $test\n";
76 print "# expected $expect, got $got\n";
83 ($in, $out) = split (':');
85 $try = "\$expect = $out; \$got = &soundex ($in);";
91 print "not ok $test\n";
92 print "# expected $expect, got $got\n";
96 print "ok $test\n" unless $bad;
103 # Knuth's test cases, scalar in, scalar out
114 # check default bad code
121 # check array in, array out
123 ('Ellery', 'Ghosh', 'Heilbronn', 'Kant', 'Ladd', 'Lissajous'):('E460', 'G200', 'H416', 'K530', 'L300', 'L222')
127 # check array with explicit undef
129 ('Mike', undef, 'Stok'):('M200', undef, 'S320')
133 # check setting $Text::Soundex::noCode
135 eval $soundex_nocode = 'Z000';
136 ('Mike', undef, 'Stok'):('M200', 'Z000', 'S320')
140 # a subtle difference between me & oracle, spotted by Rich Pinder
141 # <rpinder@hsc.usc.edu>