Debian Codegraph @

t/main.t

raw
1 #------------------------------------------------------------------------------
2 # Test script for Lingua::EN::::Fathom.pm
3 #
4 # Author : Kim Ryan, Kirk Kimmel
5 #------------------------------------------------------------------------------
6
7 use warnings;
8 use strict;
9 use Test::More tests => 8;
10 use lib "./lib";
11
12 BEGIN {
13
14 # does it load properly?
15 require_ok('Lingua::EN::Fathom');
16 }
17
18 my $sample = q{
19 Returns the number of words in the analysed text file or block. A word must
20 consist of letters a-z with at least one vowel sound, and optionally an
21 apostrophe or hyphen.
22
23 ##########################################
24 Items such as "&, K108, NSW" are not counted as words.
25 Common abbreviations such a U.S. or numbers like 1.23 will not denote the end of
26 a sentence.
27 };
28
29
30 my $text = Lingua::EN::Fathom->new();
31 $text->analyse_block($sample);
32
33 is( $text->num_chars, 312, 'sub num_chars' );
34 is( $text->num_words, 54, 'sub num_words' );
35 is( $text->num_sentences, 4,'sub num_sentences' );
36 is( $text->num_text_lines, 6,'sub num_text_lines' );
37 is( $text->num_non_text_lines, 1,'sub num_non_text_lines' );
38 is( $text->num_blank_lines, 2,'sub num_blank_lines' );
39 is( $text->num_paragraphs, 2,'sub num_paragraphs' );
40