tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

unit-compound-combinations.js (1287B)


      1 // |reftest| skip-if(!this.hasOwnProperty("Intl"))
      2 
      3 // Generated by make_intl_data.py. DO NOT EDIT.
      4 
      5 const sanctionedSimpleUnitIdentifiers = [
      6    "acre",
      7    "bit",
      8    "byte",
      9    "celsius",
     10    "centimeter",
     11    "day",
     12    "degree",
     13    "fahrenheit",
     14    "fluid-ounce",
     15    "foot",
     16    "gallon",
     17    "gigabit",
     18    "gigabyte",
     19    "gram",
     20    "hectare",
     21    "hour",
     22    "inch",
     23    "kilobit",
     24    "kilobyte",
     25    "kilogram",
     26    "kilometer",
     27    "liter",
     28    "megabit",
     29    "megabyte",
     30    "meter",
     31    "microsecond",
     32    "mile",
     33    "mile-scandinavian",
     34    "milliliter",
     35    "millimeter",
     36    "millisecond",
     37    "minute",
     38    "month",
     39    "nanosecond",
     40    "ounce",
     41    "percent",
     42    "petabyte",
     43    "pound",
     44    "second",
     45    "stone",
     46    "terabit",
     47    "terabyte",
     48    "week",
     49    "yard",
     50    "year"
     51 ];
     52 
     53 // Test all simple unit identifier combinations are allowed.
     54 
     55 for (const numerator of sanctionedSimpleUnitIdentifiers) {
     56    for (const denominator of sanctionedSimpleUnitIdentifiers) {
     57        const unit = `${numerator}-per-${denominator}`;
     58        const nf = new Intl.NumberFormat("en", {style: "unit", unit});
     59 
     60        assertEq(nf.format(1), nf.formatToParts(1).map(p => p.value).join(""));
     61    }
     62 }
     63 
     64 if (typeof reportCompare === "function")
     65    reportCompare(true, true);