summaryrefslogtreecommitdiff
path: root/gettext-tools/tests/plural-2
diff options
context:
space:
mode:
Diffstat (limited to 'gettext-tools/tests/plural-2')
-rwxr-xr-xgettext-tools/tests/plural-282
1 files changed, 82 insertions, 0 deletions
diff --git a/gettext-tools/tests/plural-2 b/gettext-tools/tests/plural-2
new file mode 100755
index 0000000..4116263
--- /dev/null
+++ b/gettext-tools/tests/plural-2
@@ -0,0 +1,82 @@
+#! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
+
+: ${MSGFMT=msgfmt}
+test -d plural-2-dir || mkdir plural-2-dir
+test -d plural-2-dir/ll || mkdir plural-2-dir/ll
+test -d plural-2-dir/ll/LC_MESSAGES || mkdir plural-2-dir/ll/LC_MESSAGES
+
+cat <<EOF > plural-2.data
+ja
+0
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+de
+n != 1
+10111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+fr
+n>1
+00111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+gd
+n==1 ? 0 : n==2 ? 1 : 2
+20122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+ro
+n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2
+10111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222
+lt
+n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2
+20111111112222222222201111111120111111112011111111201111111120111111112011111111201111111120111111112011111111222222222220111111112011111111201111111120111111112011111111201111111120111111112011111111
+ru-gettext
+n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2
+20111222222222222222201112222220111222222011122222201112222220111222222011122222201112222220111222222011122222222222222220111222222011122222201112222220111222222011122222201112222220111222222011122222
+ru-glibc
+n%100/10==1 ? 2 : n%10==1 ? 0 : (n+9)%10>3 ? 2 : 1
+20111222222222222222201112222220111222222011122222201112222220111222222011122222201112222220111222222011122222222222222220111222222011122222201112222220111222222011122222201112222220111222222011122222
+sk
+(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2
+20111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+pl
+n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2
+20111222222222222222221112222222111222222211122222221112222222111222222211122222221112222222111222222211122222222222222222111222222211122222221112222222111222222211122222221112222222111222222211122222
+sl
+n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3
+30122333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333012233333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
+EOF
+while read lang; do
+ read formula
+ read dataok
+ cat > plural-2-ll.po <<EOF
+msgid ""
+msgstr ""
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ASCII\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=10; plural=${formula};\n"
+
+msgid "X"
+msgid_plural "Y"
+msgstr[0] "0"
+msgstr[1] "1"
+msgstr[2] "2"
+msgstr[3] "3"
+msgstr[4] "4"
+msgstr[5] "5"
+msgstr[6] "6"
+msgstr[7] "7"
+msgstr[8] "8"
+msgstr[9] "9"
+EOF
+ ${MSGFMT} -o plural-2-dir/ll/LC_MESSAGES/plural.mo plural-2-ll.po || exit 1
+ (for i in '' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19; do
+ LANGUAGE= TEXTDOMAIN=plural TEXTDOMAINDIR=plural-2-dir \
+ $NGETTEXT --env LC_ALL=ll X Y ${i}0 ${i}1 ${i}2 ${i}3 ${i}4 ${i}5 ${i}6 ${i}7 ${i}8 ${i}9
+ done) > dataout
+ test "$dataok" = `cat dataout` || {
+ echo "Formula evaluation error for language $lang" 1>&2
+ echo "plural=${formula}" 1>&2
+ echo "Expected: $dataok" 1>&2
+ echo "Got: "`cat dataout` 1>&2
+ exit 1
+ }
+done < plural-2.data
+
+exit 0