File: test.pl

package info (click to toggle)
libsnowball-norwegian-perl 1.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 856 kB
  • ctags: 10
  • sloc: perl: 165; makefile: 53
file content (34 lines) | stat: -rw-r--r-- 928 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'

#########################

# change 'tests => 1' to 'tests => last_test_to_print';
my $DEBUG = 1;

use Test;
BEGIN { plan tests => 2};
use Lingua::Stem::Snowball::No;
my $stemmer = new Lingua::Stem::Snowball::No (use_cache => 0);

ok(1); # If we made it this far, we're ok.
warn("Testing stemmer against database, this will take some time\n");

open(DIFFS, "<diffs.txt") or die "Couldn't open diffs.txt: $!\n";
while(<DIFFS>)
{
	chomp;
	my($orig, $result) = split(/\s+/, $_);
	my $stemmed = $stemmer->stem($orig);
	unless ($stemmed eq $result) {
		ok(0);
		warn("$orig, $stemmed cmp $result\n") if $DEBUG;
	}
}
ok(1);

#########################

# Insert your test code below, the Test module is use()ed here so read
# its man page ( perldoc Test ) for help writing this test script.