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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
#!./perl
#
# language.t - tests for Locale::Language
#
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
}
use Locale::Language;
#-----------------------------------------------------------------------
# This is an array of tests. Each test is eval'd as an expression.
# If it evaluates to FALSE, then "not ok N" is printed for the test,
# otherwise "ok N".
#-----------------------------------------------------------------------
@TESTS =
(
#================================================
# TESTS FOR code2language
#================================================
#---- selection of examples which should all result in undef -----------
'!defined code2language()', # no argument => undef returned
'!defined code2language(undef)', # undef arg => undef returned
'!defined code2language("zz")', # illegal code => undef
'!defined code2language("jp")', # ja for lang, jp for country
#---- test recent changes ----------------------------------------------
'code2language("ae") eq "Avestan"',
'code2language("bs") eq "Bosnian"',
'code2language("ch") eq "Chamorro"',
'code2language("ce") eq "Chechen"',
'code2language("cu") eq "Church Slavic"',
'code2language("cv") eq "Chuvash"',
'code2language("hz") eq "Herero"',
'code2language("ho") eq "Hiri Motu"',
'code2language("ki") eq "Kikuyu"',
'code2language("kj") eq "Kuanyama"',
'code2language("kv") eq "Komi"',
'code2language("mh") eq "Marshall"',
'code2language("nv") eq "Navajo"',
'code2language("nr") eq "Ndebele, South"',
'code2language("nd") eq "Ndebele, North"',
'code2language("ng") eq "Ndonga"',
'code2language("nn") eq "Norwegian Nynorsk"',
'code2language("nb") eq "Norwegian Bokmål"',
'code2language("ny") eq "Chichewa; Nyanja"',
'code2language("oc") eq "Occitan (post 1500)"',
'code2language("os") eq "Ossetian; Ossetic"',
'code2language("pi") eq "Pali"',
'!defined code2language("sh")', # Serbo-Croatian withdrawn
'code2language("se") eq "Sami"',
'code2language("sc") eq "Sardinian"',
'code2language("kw") eq "Cornish"',
'code2language("gv") eq "Manx"',
'code2language("lb") eq "Letzeburgesch"',
'code2language("he") eq "Hebrew"',
'!defined code2language("iw")', # Hebrew withdrawn
'code2language("id") eq "Indonesian"',
'!defined code2language("in")', # Indonesian withdrawn
'code2language("iu") eq "Inuktitut"',
'code2language("ug") eq "Uighur"',
'!defined code2language("ji")', # Yiddish withdrawn
'code2language("yi") eq "Yiddish"',
'code2language("za") eq "Zhuang"',
#---- some successful examples -----------------------------------------
'code2language("DA") eq "Danish"',
'code2language("eo") eq "Esperanto"',
'code2language("fi") eq "Finnish"',
'code2language("en") eq "English"',
'code2language("aa") eq "Afar"', # first in DATA segment
'code2language("zu") eq "Zulu"', # last in DATA segment
#================================================
# TESTS FOR language2code
#================================================
#---- selection of examples which should all result in undef -----------
'!defined language2code()', # no argument => undef returned
'!defined language2code(undef)', # undef arg => undef returned
'!defined language2code("Banana")', # illegal lang name => undef
#---- some successful examples -----------------------------------------
'language2code("Japanese") eq "ja"',
'language2code("japanese") eq "ja"',
'language2code("japanese") ne "jp"',
'language2code("French") eq "fr"',
'language2code("Greek") eq "el"',
'language2code("english") eq "en"',
'language2code("ESTONIAN") eq "et"',
'language2code("Afar") eq "aa"', # first in DATA segment
'language2code("Zulu") eq "zu"', # last in DATA segment
);
print "1..", int(@TESTS), "\n";
$testid = 1;
foreach $test (@TESTS)
{
eval "print (($test) ? \"ok $testid\\n\" : \"not ok $testid\\n\" )";
print "not ok $testid\n" if $@;
++$testid;
}
exit 0;
|