File: 10-generate.t

package info (click to toggle)
libtext-hunspell-perl 2.16-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,052 kB
  • sloc: perl: 99; makefile: 8
file content (34 lines) | stat: -rw-r--r-- 1,237 bytes parent folder | download | duplicates (2)
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
use strict;
use warnings;

use Data::Dumper;
use Test::More tests => 16;
use Text::Hunspell;

my $speller = Text::Hunspell->new(qw(./t/morph.aff ./t/morph.dic));
die unless $speller;

my @data = (
  [[qw( drink  eat             )], [ 'drink'        ]],
  [[qw( drink  eats            )], [ 'drinks'       ]],
  [[qw( drink  ate             )], [ 'drank'        ]],
  [[qw( drink  eaten           )], [ 'drunk'        ]],
  [[qw( drink  eatable         )], [ 'drinkable'    ]],
  [[qw( drink  eatables        )], [ 'drinkables'   ]],
  [[qw( drink  phenomena       )], [ 'drinks'       ]],
  [[qw( drinks  eat            )], [ 'drink'        ]],
  [[qw( drinks  eats           )], [ 'drinks'       ]],
  [[qw( drinks  ate            )], [ 'drank'        ]],
  [[qw( drinks  eaten          )], [ 'drunk'        ]],
  [[qw( drinks  eatable        )], [ 'drinkable'    ]],
  [[qw( drinks  eatables       )], [ 'drinkables'   ]],
  [[qw( drinks  phenomena      )], [ 'drinks'       ]],
  [[qw( undrinkable  phenomena )], [ 'undrinkables' ]],
  [[qw( phenomenon  drinks     )], [ 'phenomena'    ]],
);

foreach my $data (@data)
{
  my($input, $output) = @$data;
  is_deeply [$speller->generate(@$input)], $output, "@{$input} => @{$output}";
}