Plural rules: updates for UTS #35 Rev 33
[lhc/web/wiklou.git] / tests / phpunit / languages / utils / CLDRPluralRuleEvaluatorTest.php
index 6abd09f..71d32c3 100644 (file)
@@ -81,6 +81,56 @@ class CLDRPluralRuleEvaluatorTest extends MediaWikiTestCase {
                        array( 0, 'n in 3..10,13..19', 13, 'scottish rule - ranges with comma' ),
 
                        array( 0, '5 mod 3 is n', 2, 'n as result of mod - no need to pass' ),
+
+                       # Revision 33 new operand examples
+                       # expected, rule, number, comment
+                       array( 0, 'i is 1', '1.00', 'new operand i' ),
+                       array( 0, 'v is 2', '1.00', 'new operand v' ),
+                       array( 0, 'w is 0', '1.00', 'new operand w' ),
+                       array( 0, 'f is 0', '1.00', 'new operand f' ),
+                       array( 0, 't is 0', '1.00', 'new operand t' ),
+
+                       array( 0, 'i is 1', '1.30', 'new operand i' ),
+                       array( 0, 'v is 2', '1.30', 'new operand v' ),
+                       array( 0, 'w is 1', '1.30', 'new operand w' ),
+                       array( 0, 'f is 30', '1.30', 'new operand f' ),
+                       array( 0, 't is 3', '1.30', 'new operand t' ),
+
+                       array( 0, 'i is 1', '1.03', 'new operand i' ),
+                       array( 0, 'v is 2', '1.03', 'new operand v' ),
+                       array( 0, 'w is 2', '1.03', 'new operand w' ),
+                       array( 0, 'f is 3', '1.03', 'new operand f' ),
+                       array( 0, 't is 3', '1.03', 'new operand t' ),
+
+                       # Revision 33 new operator aliases
+                       # expected, rule, number, comment
+                       array( 0, 'n % 3 is 1', 7, 'new % operator' ),
+                       array( 0, 'n = 1,3,5', 3, 'new = operator' ),
+                       array( 1, 'n != 1,3,5', 5, 'new != operator' ),
+
+                       # Revision 33 samples
+                       # expected, rule, number, comment
+                       array( 0, 'n in 1,3,5@integer 3~10, 103~110, 1003, … @decimal 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 103.0, 1003.0, …', 3, 'samples' ),
+
+                       # Revision 33 some test cases from CLDR
+                       array( 0, 'i = 1 and v = 0 or i = 0 and t = 1', '0.1', 'pt one' ),
+                       array( 0, 'i = 1 and v = 0 or i = 0 and t = 1', '0.01', 'pt one' ),
+                       array( 0, 'i = 1 and v = 0 or i = 0 and t = 1', '0.10', 'pt one' ),
+                       array( 0, 'i = 1 and v = 0 or i = 0 and t = 1', '0.010', 'pt one' ),
+                       array( 0, 'i = 1 and v = 0 or i = 0 and t = 1', '0.100', 'pt one' ),
+                       array( 1, 'i = 1 and v = 0 or i = 0 and t = 1', '0.0', 'pt other' ),
+                       array( 1, 'i = 1 and v = 0 or i = 0 and t = 1', '0.2', 'pt other' ),
+                       array( 1, 'i = 1 and v = 0 or i = 0 and t = 1', '10.0', 'pt other' ),
+                       array( 1, 'i = 1 and v = 0 or i = 0 and t = 1', '100.0', 'pt other' ),
+                       array( 0, 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14', '2', 'bs few' ),
+                       array( 0, 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14', '4', 'bs few' ),
+                       array( 0, 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14', '22', 'bs few' ),
+                       array( 0, 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14', '102', 'bs few' ),
+                       array( 0, 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14', '0.2', 'bs few' ),
+                       array( 0, 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14', '0.4', 'bs few' ),
+                       array( 0, 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14', '10.2', 'bs few' ),
+                       array( 1, 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14', '10.0', 'bs other' ),
+
                );
 
                return $tests;