File: 08-corner-cases.t

package info (click to toggle)
liblingua-identify-perl 0.51-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 716 kB
  • sloc: perl: 7,791; makefile: 2
file content (84 lines) | stat: -rw-r--r-- 2,257 bytes parent folder | download | duplicates (4)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/perl

use Test::More tests => 14;

BEGIN {
    use_ok('Lingua::Identify', qw/:language_manipulation :language_identification/)
};

# Check language of undef or space...
is(langof(), undef, "Language of nothing is undefined");

my @undef = langof();
is_deeply( [ @undef ] , [ ] , "Language of nothing is nothing");

is(langof( { method => 'smallwords' }, ' '), undef, "Language of space is undefined");



# Check language for word 'melhor'
# my @pt = langof( { method => 'suffixes4' }, 'melhor');
# is_deeply( [ @pt ], [ 'pt', 1 ],
#            "list of possible languages with 'melhor' word, using 'suffixes4' method.");
# is_deeply(confidence(@pt), 1,
#            "Confidence for 'melhor' being portuguese using 'suffixes4' method.");



my @xx = langof( { method => 'suffixes4' }, 'z');

is_deeply( [ @xx ], [ ]);
is_deeply(confidence(@xx), 0 );


is_deeply(	[ deactivate_all_languages()               ],
		[                                          ]);

is_deeply(	[ get_active_languages()                   ],
		[                                          ]);

my @pt = langof( { method => 'suffixes4' }, 'melhor');

is_deeply( [ @pt ], [  ]);
is_deeply(confidence(@pt), 0 );


is_deeply(	[ sort ( set_active_languages(qw/pt/) )    ],
		[ qw/pt/                                   ]);


is_deeply(	[ get_active_languages()                   ],
		[ qw/pt/                                   ]);


@pt = langof( { method => 'suffixes4' }, 'zzzzzz');

is_deeply( [ @pt ], [ ]);
is_deeply(confidence(@pt), 0 );

__END__




is_deeply(	[ sort ( get_active_languages() )          ],
		[ qw/fr it/                                ]);

is_deeply(	[ activate_all_languages()                 ],
		[ get_all_languages()                      ]);

is(name_of('pt'), 'portuguese');

deactivate_all_languages();

is_deeply(	[ get_active_languages()                   ],
		[                                          ]);

is_deeply(      [ activate_all_languages()                 ],
                [ get_all_languages                        ]);

is_deeply(	[ sort ( get_all_languages() )             ],
		[ sort @languages                          ]);

is_deeply(	[ sort ( get_active_languages() )          ],
		[ sort @languages                          ]);