intl/locale/tests/unit/test_pluralForm.js

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 /**
     6  * Make sure each of the plural forms have the correct number of forms and
     7  * match up in functionality.
     8  */
    10 Components.utils.import("resource://gre/modules/PluralForm.jsm");
    12 function run_test()
    13 {
    14   let allExpect = [[
    15     // 0: Chinese 0-9, 10-19, ..., 90-99
    16     1,1,1,1,1,1,1,1,1,1,
    17     1,1,1,1,1,1,1,1,1,1,
    18     1,1,1,1,1,1,1,1,1,1,
    19     1,1,1,1,1,1,1,1,1,1,
    20     1,1,1,1,1,1,1,1,1,1,
    21     1,1,1,1,1,1,1,1,1,1,
    22     1,1,1,1,1,1,1,1,1,1,
    23     1,1,1,1,1,1,1,1,1,1,
    24     1,1,1,1,1,1,1,1,1,1,
    25     1,1,1,1,1,1,1,1,1,1,
    26     // 100-109, 110-119, ..., 190-199
    27     1,1,1,1,1,1,1,1,1,1,
    28     1,1,1,1,1,1,1,1,1,1,
    29     1,1,1,1,1,1,1,1,1,1,
    30     1,1,1,1,1,1,1,1,1,1,
    31     1,1,1,1,1,1,1,1,1,1,
    32     1,1,1,1,1,1,1,1,1,1,
    33     1,1,1,1,1,1,1,1,1,1,
    34     1,1,1,1,1,1,1,1,1,1,
    35     1,1,1,1,1,1,1,1,1,1,
    36     1,1,1,1,1,1,1,1,1,1,
    37     // 200-209, 210-219, ..., 290-299
    38     1,1,1,1,1,1,1,1,1,1,
    39     1,1,1,1,1,1,1,1,1,1,
    40     1,1,1,1,1,1,1,1,1,1,
    41     1,1,1,1,1,1,1,1,1,1,
    42     1,1,1,1,1,1,1,1,1,1,
    43     1,1,1,1,1,1,1,1,1,1,
    44     1,1,1,1,1,1,1,1,1,1,
    45     1,1,1,1,1,1,1,1,1,1,
    46     1,1,1,1,1,1,1,1,1,1,
    47     1,1,1,1,1,1,1,1,1,1,
    48   ], [
    49     // 1: English 0-9, 10-19, ..., 90-99
    50     2,1,2,2,2,2,2,2,2,2,
    51     2,2,2,2,2,2,2,2,2,2,
    52     2,2,2,2,2,2,2,2,2,2,
    53     2,2,2,2,2,2,2,2,2,2,
    54     2,2,2,2,2,2,2,2,2,2,
    55     2,2,2,2,2,2,2,2,2,2,
    56     2,2,2,2,2,2,2,2,2,2,
    57     2,2,2,2,2,2,2,2,2,2,
    58     2,2,2,2,2,2,2,2,2,2,
    59     2,2,2,2,2,2,2,2,2,2,
    60     // 100-109, 110-119, ..., 190-199
    61     2,2,2,2,2,2,2,2,2,2,
    62     2,2,2,2,2,2,2,2,2,2,
    63     2,2,2,2,2,2,2,2,2,2,
    64     2,2,2,2,2,2,2,2,2,2,
    65     2,2,2,2,2,2,2,2,2,2,
    66     2,2,2,2,2,2,2,2,2,2,
    67     2,2,2,2,2,2,2,2,2,2,
    68     2,2,2,2,2,2,2,2,2,2,
    69     2,2,2,2,2,2,2,2,2,2,
    70     2,2,2,2,2,2,2,2,2,2,
    71     // 200-209, 210-219, ..., 290-299
    72     2,2,2,2,2,2,2,2,2,2,
    73     2,2,2,2,2,2,2,2,2,2,
    74     2,2,2,2,2,2,2,2,2,2,
    75     2,2,2,2,2,2,2,2,2,2,
    76     2,2,2,2,2,2,2,2,2,2,
    77     2,2,2,2,2,2,2,2,2,2,
    78     2,2,2,2,2,2,2,2,2,2,
    79     2,2,2,2,2,2,2,2,2,2,
    80     2,2,2,2,2,2,2,2,2,2,
    81     2,2,2,2,2,2,2,2,2,2,
    82   ], [
    83     // 2: French 0-9, 10-19, ..., 90-99
    84     1,1,2,2,2,2,2,2,2,2,
    85     2,2,2,2,2,2,2,2,2,2,
    86     2,2,2,2,2,2,2,2,2,2,
    87     2,2,2,2,2,2,2,2,2,2,
    88     2,2,2,2,2,2,2,2,2,2,
    89     2,2,2,2,2,2,2,2,2,2,
    90     2,2,2,2,2,2,2,2,2,2,
    91     2,2,2,2,2,2,2,2,2,2,
    92     2,2,2,2,2,2,2,2,2,2,
    93     2,2,2,2,2,2,2,2,2,2,
    94     // 100-109, 110-119, ..., 190-199
    95     2,2,2,2,2,2,2,2,2,2,
    96     2,2,2,2,2,2,2,2,2,2,
    97     2,2,2,2,2,2,2,2,2,2,
    98     2,2,2,2,2,2,2,2,2,2,
    99     2,2,2,2,2,2,2,2,2,2,
   100     2,2,2,2,2,2,2,2,2,2,
   101     2,2,2,2,2,2,2,2,2,2,
   102     2,2,2,2,2,2,2,2,2,2,
   103     2,2,2,2,2,2,2,2,2,2,
   104     2,2,2,2,2,2,2,2,2,2,
   105     // 200-209, 210-219, ..., 290-299
   106     2,2,2,2,2,2,2,2,2,2,
   107     2,2,2,2,2,2,2,2,2,2,
   108     2,2,2,2,2,2,2,2,2,2,
   109     2,2,2,2,2,2,2,2,2,2,
   110     2,2,2,2,2,2,2,2,2,2,
   111     2,2,2,2,2,2,2,2,2,2,
   112     2,2,2,2,2,2,2,2,2,2,
   113     2,2,2,2,2,2,2,2,2,2,
   114     2,2,2,2,2,2,2,2,2,2,
   115     2,2,2,2,2,2,2,2,2,2,
   116   ], [
   117     // 3: Latvian 0-9, 10-19, ..., 90-99
   118     1,2,3,3,3,3,3,3,3,3,
   119     3,3,3,3,3,3,3,3,3,3,
   120     3,2,3,3,3,3,3,3,3,3,
   121     3,2,3,3,3,3,3,3,3,3,
   122     3,2,3,3,3,3,3,3,3,3,
   123     3,2,3,3,3,3,3,3,3,3,
   124     3,2,3,3,3,3,3,3,3,3,
   125     3,2,3,3,3,3,3,3,3,3,
   126     3,2,3,3,3,3,3,3,3,3,
   127     3,2,3,3,3,3,3,3,3,3,
   128     // 100-109, 110-119, ..., 190-199
   129     3,2,3,3,3,3,3,3,3,3,
   130     3,3,3,3,3,3,3,3,3,3,
   131     3,2,3,3,3,3,3,3,3,3,
   132     3,2,3,3,3,3,3,3,3,3,
   133     3,2,3,3,3,3,3,3,3,3,
   134     3,2,3,3,3,3,3,3,3,3,
   135     3,2,3,3,3,3,3,3,3,3,
   136     3,2,3,3,3,3,3,3,3,3,
   137     3,2,3,3,3,3,3,3,3,3,
   138     3,2,3,3,3,3,3,3,3,3,
   139     // 200-209, 210-219, ..., 290-299
   140     3,2,3,3,3,3,3,3,3,3,
   141     3,3,3,3,3,3,3,3,3,3,
   142     3,2,3,3,3,3,3,3,3,3,
   143     3,2,3,3,3,3,3,3,3,3,
   144     3,2,3,3,3,3,3,3,3,3,
   145     3,2,3,3,3,3,3,3,3,3,
   146     3,2,3,3,3,3,3,3,3,3,
   147     3,2,3,3,3,3,3,3,3,3,
   148     3,2,3,3,3,3,3,3,3,3,
   149     3,2,3,3,3,3,3,3,3,3,
   150   ], [
   151     // 4: Scottish Gaelic 0-9, 10-19, ..., 90-99
   152     4,1,2,3,3,3,3,3,3,3,
   153     3,1,2,3,3,3,3,3,3,3,
   154     4,4,4,4,4,4,4,4,4,4,
   155     4,4,4,4,4,4,4,4,4,4,
   156     4,4,4,4,4,4,4,4,4,4,
   157     4,4,4,4,4,4,4,4,4,4,
   158     4,4,4,4,4,4,4,4,4,4,
   159     4,4,4,4,4,4,4,4,4,4,
   160     4,4,4,4,4,4,4,4,4,4,
   161     4,4,4,4,4,4,4,4,4,4,
   162     // 100-109, 110-119, ..., 190-199
   163     4,4,4,4,4,4,4,4,4,4,
   164     4,4,4,4,4,4,4,4,4,4,
   165     4,4,4,4,4,4,4,4,4,4,
   166     4,4,4,4,4,4,4,4,4,4,
   167     4,4,4,4,4,4,4,4,4,4,
   168     4,4,4,4,4,4,4,4,4,4,
   169     4,4,4,4,4,4,4,4,4,4,
   170     4,4,4,4,4,4,4,4,4,4,
   171     4,4,4,4,4,4,4,4,4,4,
   172     4,4,4,4,4,4,4,4,4,4,
   173     // 200-209, 210-219, ..., 290-299
   174     4,4,4,4,4,4,4,4,4,4,
   175     4,4,4,4,4,4,4,4,4,4,
   176     4,4,4,4,4,4,4,4,4,4,
   177     4,4,4,4,4,4,4,4,4,4,
   178     4,4,4,4,4,4,4,4,4,4,
   179     4,4,4,4,4,4,4,4,4,4,
   180     4,4,4,4,4,4,4,4,4,4,
   181     4,4,4,4,4,4,4,4,4,4,
   182     4,4,4,4,4,4,4,4,4,4,
   183     4,4,4,4,4,4,4,4,4,4,
   184   ], [
   185     // 5: Romanian 0-9, 10-19, ..., 90-99
   186     2,1,2,2,2,2,2,2,2,2,
   187     2,2,2,2,2,2,2,2,2,2,
   188     3,3,3,3,3,3,3,3,3,3,
   189     3,3,3,3,3,3,3,3,3,3,
   190     3,3,3,3,3,3,3,3,3,3,
   191     3,3,3,3,3,3,3,3,3,3,
   192     3,3,3,3,3,3,3,3,3,3,
   193     3,3,3,3,3,3,3,3,3,3,
   194     3,3,3,3,3,3,3,3,3,3,
   195     3,3,3,3,3,3,3,3,3,3,
   196     // 100-109, 110-119, ..., 190-199
   197     3,2,2,2,2,2,2,2,2,2,
   198     2,2,2,2,2,2,2,2,2,2,
   199     3,3,3,3,3,3,3,3,3,3,
   200     3,3,3,3,3,3,3,3,3,3,
   201     3,3,3,3,3,3,3,3,3,3,
   202     3,3,3,3,3,3,3,3,3,3,
   203     3,3,3,3,3,3,3,3,3,3,
   204     3,3,3,3,3,3,3,3,3,3,
   205     3,3,3,3,3,3,3,3,3,3,
   206     3,3,3,3,3,3,3,3,3,3,
   207     // 200-209, 210-219, ..., 290-299
   208     3,2,2,2,2,2,2,2,2,2,
   209     2,2,2,2,2,2,2,2,2,2,
   210     3,3,3,3,3,3,3,3,3,3,
   211     3,3,3,3,3,3,3,3,3,3,
   212     3,3,3,3,3,3,3,3,3,3,
   213     3,3,3,3,3,3,3,3,3,3,
   214     3,3,3,3,3,3,3,3,3,3,
   215     3,3,3,3,3,3,3,3,3,3,
   216     3,3,3,3,3,3,3,3,3,3,
   217     3,3,3,3,3,3,3,3,3,3,
   218   ], [
   219     // 6: Lithuanian 0-9, 10-19, ..., 90-99
   220     2,1,3,3,3,3,3,3,3,3,
   221     2,2,2,2,2,2,2,2,2,2,
   222     2,1,3,3,3,3,3,3,3,3,
   223     2,1,3,3,3,3,3,3,3,3,
   224     2,1,3,3,3,3,3,3,3,3,
   225     2,1,3,3,3,3,3,3,3,3,
   226     2,1,3,3,3,3,3,3,3,3,
   227     2,1,3,3,3,3,3,3,3,3,
   228     2,1,3,3,3,3,3,3,3,3,
   229     2,1,3,3,3,3,3,3,3,3,
   230     // 100-109, 110-119, ..., 190-199
   231     2,1,3,3,3,3,3,3,3,3,
   232     2,2,2,2,2,2,2,2,2,2,
   233     2,1,3,3,3,3,3,3,3,3,
   234     2,1,3,3,3,3,3,3,3,3,
   235     2,1,3,3,3,3,3,3,3,3,
   236     2,1,3,3,3,3,3,3,3,3,
   237     2,1,3,3,3,3,3,3,3,3,
   238     2,1,3,3,3,3,3,3,3,3,
   239     2,1,3,3,3,3,3,3,3,3,
   240     2,1,3,3,3,3,3,3,3,3,
   241     // 200-209, 210-219, ..., 290-299
   242     2,1,3,3,3,3,3,3,3,3,
   243     2,2,2,2,2,2,2,2,2,2,
   244     2,1,3,3,3,3,3,3,3,3,
   245     2,1,3,3,3,3,3,3,3,3,
   246     2,1,3,3,3,3,3,3,3,3,
   247     2,1,3,3,3,3,3,3,3,3,
   248     2,1,3,3,3,3,3,3,3,3,
   249     2,1,3,3,3,3,3,3,3,3,
   250     2,1,3,3,3,3,3,3,3,3,
   251     2,1,3,3,3,3,3,3,3,3,
   252   ], [
   253     // 7: Russian 0-9, 10-19, ..., 90-99
   254     3,1,2,2,2,3,3,3,3,3,
   255     3,3,3,3,3,3,3,3,3,3,
   256     3,1,2,2,2,3,3,3,3,3,
   257     3,1,2,2,2,3,3,3,3,3,
   258     3,1,2,2,2,3,3,3,3,3,
   259     3,1,2,2,2,3,3,3,3,3,
   260     3,1,2,2,2,3,3,3,3,3,
   261     3,1,2,2,2,3,3,3,3,3,
   262     3,1,2,2,2,3,3,3,3,3,
   263     3,1,2,2,2,3,3,3,3,3,
   264     // 100-109, 110-119, ..., 190-199
   265     3,1,2,2,2,3,3,3,3,3,
   266     3,3,3,3,3,3,3,3,3,3,
   267     3,1,2,2,2,3,3,3,3,3,
   268     3,1,2,2,2,3,3,3,3,3,
   269     3,1,2,2,2,3,3,3,3,3,
   270     3,1,2,2,2,3,3,3,3,3,
   271     3,1,2,2,2,3,3,3,3,3,
   272     3,1,2,2,2,3,3,3,3,3,
   273     3,1,2,2,2,3,3,3,3,3,
   274     3,1,2,2,2,3,3,3,3,3,
   275     // 200-209, 210-219, ..., 290-299
   276     3,1,2,2,2,3,3,3,3,3,
   277     3,3,3,3,3,3,3,3,3,3,
   278     3,1,2,2,2,3,3,3,3,3,
   279     3,1,2,2,2,3,3,3,3,3,
   280     3,1,2,2,2,3,3,3,3,3,
   281     3,1,2,2,2,3,3,3,3,3,
   282     3,1,2,2,2,3,3,3,3,3,
   283     3,1,2,2,2,3,3,3,3,3,
   284     3,1,2,2,2,3,3,3,3,3,
   285     3,1,2,2,2,3,3,3,3,3,
   286   ], [
   287     // 8: Slovak 0-9, 10-19, ..., 90-99
   288     3,1,2,2,2,3,3,3,3,3,
   289     3,3,3,3,3,3,3,3,3,3,
   290     3,3,3,3,3,3,3,3,3,3,
   291     3,3,3,3,3,3,3,3,3,3,
   292     3,3,3,3,3,3,3,3,3,3,
   293     3,3,3,3,3,3,3,3,3,3,
   294     3,3,3,3,3,3,3,3,3,3,
   295     3,3,3,3,3,3,3,3,3,3,
   296     3,3,3,3,3,3,3,3,3,3,
   297     3,3,3,3,3,3,3,3,3,3,
   298     // 100-109, 110-119, ..., 190-199
   299     3,3,3,3,3,3,3,3,3,3,
   300     3,3,3,3,3,3,3,3,3,3,
   301     3,3,3,3,3,3,3,3,3,3,
   302     3,3,3,3,3,3,3,3,3,3,
   303     3,3,3,3,3,3,3,3,3,3,
   304     3,3,3,3,3,3,3,3,3,3,
   305     3,3,3,3,3,3,3,3,3,3,
   306     3,3,3,3,3,3,3,3,3,3,
   307     3,3,3,3,3,3,3,3,3,3,
   308     3,3,3,3,3,3,3,3,3,3,
   309     // 200-209, 210-219, ..., 290-299
   310     3,3,3,3,3,3,3,3,3,3,
   311     3,3,3,3,3,3,3,3,3,3,
   312     3,3,3,3,3,3,3,3,3,3,
   313     3,3,3,3,3,3,3,3,3,3,
   314     3,3,3,3,3,3,3,3,3,3,
   315     3,3,3,3,3,3,3,3,3,3,
   316     3,3,3,3,3,3,3,3,3,3,
   317     3,3,3,3,3,3,3,3,3,3,
   318     3,3,3,3,3,3,3,3,3,3,
   319     3,3,3,3,3,3,3,3,3,3,
   320   ], [
   321     // 9: Polish 0-9, 10-19, ..., 90-99
   322     3,1,2,2,2,3,3,3,3,3,
   323     3,3,3,3,3,3,3,3,3,3,
   324     3,3,2,2,2,3,3,3,3,3,
   325     3,3,2,2,2,3,3,3,3,3,
   326     3,3,2,2,2,3,3,3,3,3,
   327     3,3,2,2,2,3,3,3,3,3,
   328     3,3,2,2,2,3,3,3,3,3,
   329     3,3,2,2,2,3,3,3,3,3,
   330     3,3,2,2,2,3,3,3,3,3,
   331     3,3,2,2,2,3,3,3,3,3,
   332     // 100-109, 110-119, ..., 190-199
   333     3,3,2,2,2,3,3,3,3,3,
   334     3,3,3,3,3,3,3,3,3,3,
   335     3,3,2,2,2,3,3,3,3,3,
   336     3,3,2,2,2,3,3,3,3,3,
   337     3,3,2,2,2,3,3,3,3,3,
   338     3,3,2,2,2,3,3,3,3,3,
   339     3,3,2,2,2,3,3,3,3,3,
   340     3,3,2,2,2,3,3,3,3,3,
   341     3,3,2,2,2,3,3,3,3,3,
   342     3,3,2,2,2,3,3,3,3,3,
   343     // 200-209, 210-219, ..., 290-299
   344     3,3,2,2,2,3,3,3,3,3,
   345     3,3,3,3,3,3,3,3,3,3,
   346     3,3,2,2,2,3,3,3,3,3,
   347     3,3,2,2,2,3,3,3,3,3,
   348     3,3,2,2,2,3,3,3,3,3,
   349     3,3,2,2,2,3,3,3,3,3,
   350     3,3,2,2,2,3,3,3,3,3,
   351     3,3,2,2,2,3,3,3,3,3,
   352     3,3,2,2,2,3,3,3,3,3,
   353     3,3,2,2,2,3,3,3,3,3,
   354   ], [
   355     // 10: Slovenian 0-9, 10-19, ..., 90-99
   356     4,1,2,3,3,4,4,4,4,4,
   357     4,4,4,4,4,4,4,4,4,4,
   358     4,4,4,4,4,4,4,4,4,4,
   359     4,4,4,4,4,4,4,4,4,4,
   360     4,4,4,4,4,4,4,4,4,4,
   361     4,4,4,4,4,4,4,4,4,4,
   362     4,4,4,4,4,4,4,4,4,4,
   363     4,4,4,4,4,4,4,4,4,4,
   364     4,4,4,4,4,4,4,4,4,4,
   365     4,4,4,4,4,4,4,4,4,4,
   366     // 100-109, 110-119, ..., 190-199
   367     4,1,2,3,3,4,4,4,4,4,
   368     4,4,4,4,4,4,4,4,4,4,
   369     4,4,4,4,4,4,4,4,4,4,
   370     4,4,4,4,4,4,4,4,4,4,
   371     4,4,4,4,4,4,4,4,4,4,
   372     4,4,4,4,4,4,4,4,4,4,
   373     4,4,4,4,4,4,4,4,4,4,
   374     4,4,4,4,4,4,4,4,4,4,
   375     4,4,4,4,4,4,4,4,4,4,
   376     4,4,4,4,4,4,4,4,4,4,
   377     // 200-209, 210-219, ..., 290-299
   378     4,1,2,3,3,4,4,4,4,4,
   379     4,4,4,4,4,4,4,4,4,4,
   380     4,4,4,4,4,4,4,4,4,4,
   381     4,4,4,4,4,4,4,4,4,4,
   382     4,4,4,4,4,4,4,4,4,4,
   383     4,4,4,4,4,4,4,4,4,4,
   384     4,4,4,4,4,4,4,4,4,4,
   385     4,4,4,4,4,4,4,4,4,4,
   386     4,4,4,4,4,4,4,4,4,4,
   387     4,4,4,4,4,4,4,4,4,4,
   388   ], [
   389     // 11: Irish Gaeilge 0-9, 10-19, ..., 90-99
   390     5,1,2,3,3,3,3,4,4,4,
   391     4,5,5,5,5,5,5,5,5,5,
   392     5,5,5,5,5,5,5,5,5,5,
   393     5,5,5,5,5,5,5,5,5,5,
   394     5,5,5,5,5,5,5,5,5,5,
   395     5,5,5,5,5,5,5,5,5,5,
   396     5,5,5,5,5,5,5,5,5,5,
   397     5,5,5,5,5,5,5,5,5,5,
   398     5,5,5,5,5,5,5,5,5,5,
   399     5,5,5,5,5,5,5,5,5,5,
   400     // 100-109, 110-119, ..., 190-199
   401     5,5,5,5,5,5,5,5,5,5,
   402     5,5,5,5,5,5,5,5,5,5,
   403     5,5,5,5,5,5,5,5,5,5,
   404     5,5,5,5,5,5,5,5,5,5,
   405     5,5,5,5,5,5,5,5,5,5,
   406     5,5,5,5,5,5,5,5,5,5,
   407     5,5,5,5,5,5,5,5,5,5,
   408     5,5,5,5,5,5,5,5,5,5,
   409     5,5,5,5,5,5,5,5,5,5,
   410     5,5,5,5,5,5,5,5,5,5,
   411     // 200-209, 210-219, ..., 290-299
   412     5,5,5,5,5,5,5,5,5,5,
   413     5,5,5,5,5,5,5,5,5,5,
   414     5,5,5,5,5,5,5,5,5,5,
   415     5,5,5,5,5,5,5,5,5,5,
   416     5,5,5,5,5,5,5,5,5,5,
   417     5,5,5,5,5,5,5,5,5,5,
   418     5,5,5,5,5,5,5,5,5,5,
   419     5,5,5,5,5,5,5,5,5,5,
   420     5,5,5,5,5,5,5,5,5,5,
   421     5,5,5,5,5,5,5,5,5,5,
   422   ], [
   423     // 12: Arabic 0-9, 10-19, ..., 90-99
   424     6,1,2,3,3,3,3,3,3,3,
   425     3,4,4,4,4,4,4,4,4,4,
   426     4,4,4,4,4,4,4,4,4,4,
   427     4,4,4,4,4,4,4,4,4,4,
   428     4,4,4,4,4,4,4,4,4,4,
   429     4,4,4,4,4,4,4,4,4,4,
   430     4,4,4,4,4,4,4,4,4,4,
   431     4,4,4,4,4,4,4,4,4,4,
   432     4,4,4,4,4,4,4,4,4,4,
   433     4,4,4,4,4,4,4,4,4,4,
   434     // 100-109, 110-119, ..., 190-199
   435     5,5,5,3,3,3,3,3,3,3,
   436     3,4,4,4,4,4,4,4,4,4,
   437     4,4,4,4,4,4,4,4,4,4,
   438     4,4,4,4,4,4,4,4,4,4,
   439     4,4,4,4,4,4,4,4,4,4,
   440     4,4,4,4,4,4,4,4,4,4,
   441     4,4,4,4,4,4,4,4,4,4,
   442     4,4,4,4,4,4,4,4,4,4,
   443     4,4,4,4,4,4,4,4,4,4,
   444     4,4,4,4,4,4,4,4,4,4,
   445     // 200-209, 210-219, ..., 290-299
   446     5,5,5,3,3,3,3,3,3,3,
   447     3,4,4,4,4,4,4,4,4,4,
   448     4,4,4,4,4,4,4,4,4,4,
   449     4,4,4,4,4,4,4,4,4,4,
   450     4,4,4,4,4,4,4,4,4,4,
   451     4,4,4,4,4,4,4,4,4,4,
   452     4,4,4,4,4,4,4,4,4,4,
   453     4,4,4,4,4,4,4,4,4,4,
   454     4,4,4,4,4,4,4,4,4,4,
   455     4,4,4,4,4,4,4,4,4,4,
   456   ], [
   457     // 13: Maltese 0-9, 10-19, ..., 90-99
   458     2,1,2,2,2,2,2,2,2,2,
   459     2,3,3,3,3,3,3,3,3,3,
   460     4,4,4,4,4,4,4,4,4,4,
   461     4,4,4,4,4,4,4,4,4,4,
   462     4,4,4,4,4,4,4,4,4,4,
   463     4,4,4,4,4,4,4,4,4,4,
   464     4,4,4,4,4,4,4,4,4,4,
   465     4,4,4,4,4,4,4,4,4,4,
   466     4,4,4,4,4,4,4,4,4,4,
   467     4,4,4,4,4,4,4,4,4,4,
   468     // 100-109, 110-119, ..., 190-199
   469     4,2,2,2,2,2,2,2,2,2,
   470     2,3,3,3,3,3,3,3,3,3,
   471     4,4,4,4,4,4,4,4,4,4,
   472     4,4,4,4,4,4,4,4,4,4,
   473     4,4,4,4,4,4,4,4,4,4,
   474     4,4,4,4,4,4,4,4,4,4,
   475     4,4,4,4,4,4,4,4,4,4,
   476     4,4,4,4,4,4,4,4,4,4,
   477     4,4,4,4,4,4,4,4,4,4,
   478     4,4,4,4,4,4,4,4,4,4,
   479     // 200-209, 210-219, ..., 290-299
   480     4,2,2,2,2,2,2,2,2,2,
   481     2,3,3,3,3,3,3,3,3,3,
   482     4,4,4,4,4,4,4,4,4,4,
   483     4,4,4,4,4,4,4,4,4,4,
   484     4,4,4,4,4,4,4,4,4,4,
   485     4,4,4,4,4,4,4,4,4,4,
   486     4,4,4,4,4,4,4,4,4,4,
   487     4,4,4,4,4,4,4,4,4,4,
   488     4,4,4,4,4,4,4,4,4,4,
   489     4,4,4,4,4,4,4,4,4,4,
   490   ], [
   491     // 14: Macedonian 0-9, 10-19, ..., 90-99
   492     3,1,2,3,3,3,3,3,3,3,
   493     3,1,2,3,3,3,3,3,3,3,
   494     3,1,2,3,3,3,3,3,3,3,
   495     3,1,2,3,3,3,3,3,3,3,
   496     3,1,2,3,3,3,3,3,3,3,
   497     3,1,2,3,3,3,3,3,3,3,
   498     3,1,2,3,3,3,3,3,3,3,
   499     3,1,2,3,3,3,3,3,3,3,
   500     3,1,2,3,3,3,3,3,3,3,
   501     3,1,2,3,3,3,3,3,3,3,
   502     // 100-109, 110-119, ..., 190-199
   503     3,1,2,3,3,3,3,3,3,3,
   504     3,1,2,3,3,3,3,3,3,3,
   505     3,1,2,3,3,3,3,3,3,3,
   506     3,1,2,3,3,3,3,3,3,3,
   507     3,1,2,3,3,3,3,3,3,3,
   508     3,1,2,3,3,3,3,3,3,3,
   509     3,1,2,3,3,3,3,3,3,3,
   510     3,1,2,3,3,3,3,3,3,3,
   511     3,1,2,3,3,3,3,3,3,3,
   512     3,1,2,3,3,3,3,3,3,3,
   513     // 200-209, 210-219, ..., 290-299
   514     3,1,2,3,3,3,3,3,3,3,
   515     3,1,2,3,3,3,3,3,3,3,
   516     3,1,2,3,3,3,3,3,3,3,
   517     3,1,2,3,3,3,3,3,3,3,
   518     3,1,2,3,3,3,3,3,3,3,
   519     3,1,2,3,3,3,3,3,3,3,
   520     3,1,2,3,3,3,3,3,3,3,
   521     3,1,2,3,3,3,3,3,3,3,
   522     3,1,2,3,3,3,3,3,3,3,
   523     3,1,2,3,3,3,3,3,3,3,
   524   ], [
   525     // 15: Icelandic 0-9, 10-19, ..., 90-99
   526     2,1,2,2,2,2,2,2,2,2,
   527     2,2,2,2,2,2,2,2,2,2,
   528     2,1,2,2,2,2,2,2,2,2,
   529     2,1,2,2,2,2,2,2,2,2,
   530     2,1,2,2,2,2,2,2,2,2,
   531     2,1,2,2,2,2,2,2,2,2,
   532     2,1,2,2,2,2,2,2,2,2,
   533     2,1,2,2,2,2,2,2,2,2,
   534     2,1,2,2,2,2,2,2,2,2,
   535     2,1,2,2,2,2,2,2,2,2,
   536     // 100-109, 110-119, ..., 190-199
   537     2,1,2,2,2,2,2,2,2,2,
   538     2,2,2,2,2,2,2,2,2,2,
   539     2,1,2,2,2,2,2,2,2,2,
   540     2,1,2,2,2,2,2,2,2,2,
   541     2,1,2,2,2,2,2,2,2,2,
   542     2,1,2,2,2,2,2,2,2,2,
   543     2,1,2,2,2,2,2,2,2,2,
   544     2,1,2,2,2,2,2,2,2,2,
   545     2,1,2,2,2,2,2,2,2,2,
   546     2,1,2,2,2,2,2,2,2,2,
   547     // 200-209, 210-219, ..., 290-299
   548     2,1,2,2,2,2,2,2,2,2,
   549     2,2,2,2,2,2,2,2,2,2,
   550     2,1,2,2,2,2,2,2,2,2,
   551     2,1,2,2,2,2,2,2,2,2,
   552     2,1,2,2,2,2,2,2,2,2,
   553     2,1,2,2,2,2,2,2,2,2,
   554     2,1,2,2,2,2,2,2,2,2,
   555     2,1,2,2,2,2,2,2,2,2,
   556     2,1,2,2,2,2,2,2,2,2,
   557     2,1,2,2,2,2,2,2,2,2,
   558   ], [
   559     // 16: Breton 0-9, 10-19, ..., 90-99
   560     5,1,2,3,3,5,5,5,5,3,
   561     5,5,5,5,5,5,5,5,5,5,
   562     5,1,2,3,3,5,5,5,5,3,
   563     5,1,2,3,3,5,5,5,5,3,
   564     5,1,2,3,3,5,5,5,5,3,
   565     5,1,2,3,3,5,5,5,5,3,
   566     5,1,2,3,3,5,5,5,5,3,
   567     5,5,5,5,5,5,5,5,5,5,
   568     5,1,2,3,3,5,5,5,5,3,
   569     5,5,5,5,5,5,5,5,5,5,
   570     // 100-109, 110-119, ..., 190-199
   571     5,1,2,3,3,5,5,5,5,3,
   572     5,5,5,5,5,5,5,5,5,5,
   573     5,1,2,3,3,5,5,5,5,3,
   574     5,1,2,3,3,5,5,5,5,3,
   575     5,1,2,3,3,5,5,5,5,3,
   576     5,1,2,3,3,5,5,5,5,3,
   577     5,1,2,3,3,5,5,5,5,3,
   578     5,5,5,5,5,5,5,5,5,5,
   579     5,1,2,3,3,5,5,5,5,3,
   580     5,5,5,5,5,5,5,5,5,5,
   581     // 200-209, 210-219, ..., 290-299
   582     5,1,2,3,3,5,5,5,5,3,
   583     5,5,5,5,5,5,5,5,5,5,
   584     5,1,2,3,3,5,5,5,5,3,
   585     5,1,2,3,3,5,5,5,5,3,
   586     5,1,2,3,3,5,5,5,5,3,
   587     5,1,2,3,3,5,5,5,5,3,
   588     5,1,2,3,3,5,5,5,5,3,
   589     5,5,5,5,5,5,5,5,5,5,
   590     5,1,2,3,3,5,5,5,5,3,
   591     5,5,5,5,5,5,5,5,5,5,
   592   ]];
   594   for (let [rule, expect] in Iterator(allExpect)) {
   595     print("\nTesting rule #" + rule);
   597     let [get, numForms] = PluralForm.makeGetter(rule);
   599     // Make sure the largest value expected matches the number of plural forms
   600     let maxExpect = Math.max.apply(this, expect);
   601     do_check_eq(maxExpect, numForms());
   603     // Make a string of numbers, e.g., 1;2;3;4;5
   604     let words = [];
   605     for (let i = 1; i <= maxExpect; i++)
   606       words.push(i);
   607     words = words.join(";");
   609     // Make sure we get the expected number
   610     for (let [index, number] in Iterator(expect)) {
   611       print(["Plural form of ", index, " should be ", number, " (", words, ")"].join(""));
   612       do_check_eq(get(index, words), number);
   613     }
   614   }
   615 }

mercurial