File: 01-basic.t

package info (click to toggle)
liblingua-en-syllable-perl 0.310-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 112 kB
  • sloc: perl: 110; makefile: 2
file content (53 lines) | stat: -rw-r--r-- 1,285 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#! perl

use 5.006;
use strict;
use warnings;

use Lingua::EN::Syllable qw/ syllable /;
use Test::More 0.88;

my %EXPECTED_SYLLABLE_COUNT =
(
    hoopty          => 2,
    bah             => 1,
    I               => 1,
    A               => 1,
    organism        => 4,
    organisms       => 4,
    antagonisms     => 5,
    schisms         => 2,
    monisms         => 3,
    puritanisms     => 5,
    criticisms      => 4,
    microorganisms  => 6,
    surrealisms     => 4,
    isms            => 2,
    organisms       => 4,
    aphorisms       => 4,
    prisms          => 2,
    anachronisms    => 5,
    dualisms        => 4,
    euphemisms      => 4,
    mechanisms      => 4,
    mannerisms      => 4,
    yogiisms        => 4,
    metabolisms     => 5,
    baptisms        => 3,
    embolisms       => 4,
    methodisms      => 4,
    executed        => 4,
    accused         => 2,
    dosed           => 1,
    w               => 2,
    cwm             => 1,

);

plan tests => int(keys %EXPECTED_SYLLABLE_COUNT);

foreach my $word (sort keys %EXPECTED_SYLLABLE_COUNT) {
    my $syllable_count = syllable($word);
    cmp_ok($syllable_count, '==', $EXPECTED_SYLLABLE_COUNT{$word},
           "number of syllables in '$word' should be $EXPECTED_SYLLABLE_COUNT{$word}");
}