Skip to content

Commit

Permalink
Update list of non-algorithmic numbering systems
Browse files Browse the repository at this point in the history
  • Loading branch information
anba authored and rwaldron committed Jun 24, 2020
1 parent 3d411fa commit 649d0d2
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 16 deletions.
46 changes: 45 additions & 1 deletion harness/testIntl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2144,28 +2144,72 @@ function isValidNumberingSystem(name) {
*/

var numberingSystemDigits = {
adlm: "𞥐𞥑𞥒𞥓𞥔𞥕𞥖𞥗𞥘𞥙",
ahom: "𑜰𑜱𑜲𑜳𑜴𑜵𑜶𑜷𑜸𑜹",
arab: "٠١٢٣٤٥٦٧٨٩",
arabext: "۰۱۲۳۴۵۶۷۸۹",
bali: "\u1B50\u1B51\u1B52\u1B53\u1B54\u1B55\u1B56\u1B57\u1B58\u1B59",
beng: "০১২৩৪৫৬৭৮৯",
bhks: "𑱐𑱑𑱒𑱓𑱔𑱕𑱖𑱗𑱘𑱙",
brah: "𑁦𑁧𑁨𑁩𑁪𑁫𑁬𑁭𑁮𑁯",
cakm: "𑄶𑄷𑄸𑄹𑄺𑄻𑄼𑄽𑄾𑄿",
cham: "꩐꩑꩒꩓꩔꩕꩖꩗꩘꩙",
deva: "०१२३४५६७८९",
diak: "𑥐𑥑𑥒𑥓𑥔𑥕𑥖𑥗𑥘𑥙",
fullwide: "0123456789",
gong: "𑶠𑶡𑶢𑶣𑶤𑶥𑶦𑶧𑶨𑶩",
gonm: "𑵐𑵑𑵒𑵓𑵔𑵕𑵖𑵗𑵘𑵙",
gujr: "૦૧૨૩૪૫૬૭૮૯",
guru: "੦੧੨੩੪੫੬੭੮੯",
hanidec: "〇一二三四五六七八九",
hmng: "𖭐𖭑𖭒𖭓𖭔𖭕𖭖𖭗𖭘𖭙",
hmnp: "𞅀𞅁𞅂𞅃𞅄𞅅𞅆𞅇𞅈𞅉",
java: "꧐꧑꧒꧓꧔꧕꧖꧗꧘꧙",
kali: "꤀꤁꤂꤃꤄꤅꤆꤇꤈꤉",
khmr: "០១២៣៤៥៦៧៨៩",
knda: "೦೧೨೩೪೫೬೭೮೯",
lana: "᪀᪁᪂᪃᪄᪅᪆᪇᪈᪉",
lanatham: "᪐᪑᪒᪓᪔᪕᪖᪗᪘᪙",
laoo: "໐໑໒໓໔໕໖໗໘໙",
latn: "0123456789",
lepc: "᱀᱁᱂᱃᱄᱅᱆᱇᱈᱉",
limb: "\u1946\u1947\u1948\u1949\u194A\u194B\u194C\u194D\u194E\u194F",
mathbold: "𝟎𝟏𝟐𝟑𝟒𝟓𝟔𝟕𝟖𝟗",
mathdbl: "𝟘𝟙𝟚𝟛𝟜𝟝𝟞𝟟𝟠𝟡",
mathmono: "𝟶𝟷𝟸𝟹𝟺𝟻𝟼𝟽𝟾𝟿",
mathsanb: "𝟬𝟭𝟮𝟯𝟰𝟱𝟲𝟳𝟴𝟵",
mathsans: "𝟢𝟣𝟤𝟥𝟦𝟧𝟨𝟩𝟪𝟫",
mlym: "൦൧൨൩൪൫൬൭൮൯",
modi: "𑙐𑙑𑙒𑙓𑙔𑙕𑙖𑙗𑙘𑙙",
mong: "᠐᠑᠒᠓᠔᠕᠖᠗᠘᠙",
mroo: "𖩠𖩡𖩢𖩣𖩤𖩥𖩦𖩧𖩨𖩩",
mtei: "꯰꯱꯲꯳꯴꯵꯶꯷꯸꯹",
mymr: "၀၁၂၃၄၅၆၇၈၉",
mymrshan: "႐႑႒႓႔႕႖႗႘႙",
mymrtlng: "꧰꧱꧲꧳꧴꧵꧶꧷꧸꧹",
newa: "𑑐𑑑𑑒𑑓𑑔𑑕𑑖𑑗𑑘𑑙",
nkoo: "߀߁߂߃߄߅߆߇߈߉",
olck: "᱐᱑᱒᱓᱔᱕᱖᱗᱘᱙",
orya: "୦୧୨୩୪୫୬୭୮୯",
osma: "𐒠𐒡𐒢𐒣𐒤𐒥𐒦𐒧𐒨𐒩",
rohg: "𐴰𐴱𐴲𐴳𐴴𐴵𐴶𐴷𐴸𐴹",
saur: "꣐꣑꣒꣓꣔꣕꣖꣗꣘꣙",
segment: "🯰🯱🯲🯳🯴🯵🯶🯷🯸🯹",
shrd: "𑇐𑇑𑇒𑇓𑇔𑇕𑇖𑇗𑇘𑇙",
sind: "𑋰𑋱𑋲𑋳𑋴𑋵𑋶𑋷𑋸𑋹",
sinh: "෦෧෨෩෪෫෬෭෮෯",
sora: "𑃰𑃱𑃲𑃳𑃴𑃵𑃶𑃷𑃸𑃹",
sund: "᮰᮱᮲᮳᮴᮵᮶᮷᮸᮹",
takr: "𑛀𑛁𑛂𑛃𑛄𑛅𑛆𑛇𑛈𑛉",
talu: "᧐᧑᧒᧓᧔᧕᧖᧗᧘᧙",
tamldec: "௦௧௨௩௪௫௬௭௮௯",
telu: "౦౧౨౩౪౫౬౭౮౯",
thai: "๐๑๒๓๔๕๖๗๘๙",
tibt: "༠༡༢༣༤༥༦༧༨༩"
tibt: "༠༡༢༣༤༥༦༧༨༩",
tirh: "𑓐𑓑𑓒𑓓𑓔𑓕𑓖𑓗𑓘𑓙",
vaii: "꘠꘡꘢꘣꘤꘥꘦꘧꘨꘩",
wara: "𑣠𑣡𑣢𑣣𑣤𑣥𑣦𑣧𑣨𑣩",
wcho: "𞋰𞋱𞋲𞋳𞋴𞋵𞋶𞋷𞋸𞋹",
};


Expand Down
81 changes: 66 additions & 15 deletions test/intl402/NumberFormat/prototype/format/numbering-systems.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,98 @@
// This code is governed by the BSD license found in the LICENSE file.

/*---
es5id: 11.3.2_FN_3_e
esid: table-numbering-system-digits
description: >
Tests that Intl.NumberFormat.prototype.format supports all
alternative numbering systems.
Tests that Intl.NumberFormat.prototype.format supports all
numbering systems with simple digit mappings.
author: Roozbeh Pournader
---*/

var numberingSystems = {
const numberingSystems = {
adlm: 0x1E950,
ahom: 0x11730,
arab: 0x0660,
arabext: 0x06F0,
bali: 0x1B50,
beng: 0x09E6,
bhks: 0x11C50,
brah: 0x11066,
cakm: 0x11136,
cham: 0xAA50,
deva: 0x0966,
diak: 0x11950,
fullwide: 0xFF10,
gong: 0x11DA0,
gonm: 0x11D50,
gujr: 0x0AE6,
guru: 0x0A66,
hanidec: [0x3007, 0x4E00, 0x4E8C, 0x4E09, 0x56DB,
0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D],
hmng: 0x16B50,
hmnp: 0x1E140,
java: 0xA9D0,
kali: 0xA900,
khmr: 0x17E0,
knda: 0x0CE6,
lana: 0x1A80,
lanatham: 0x1A90,
laoo: 0x0ED0,
latn: 0x0030,
lepc: 0x1C40,
limb: 0x1946,
mathbold: 0x1D7CE,
mathdbl: 0x1D7D8,
mathmono: 0x1D7F6,
mathsanb: 0x1D7EC,
mathsans: 0x1D7E2,
mlym: 0x0D66,
modi: 0x11650,
mong: 0x1810,
mroo: 0x16A60,
mtei: 0xABF0,
mymr: 0x1040,
mymrshan: 0x1090,
mymrtlng: 0xA9F0,
newa: 0x11450,
nkoo: 0x07C0,
olck: 0x1C50,
orya: 0x0B66,
osma: 0x104A0,
rohg: 0x10D30,
saur: 0xA8D0,
segment: 0x1FBF0,
shrd: 0x111D0,
sind: 0x112F0,
sinh: 0x0DE6,
sora: 0x110F0,
sund: 0x1BB0,
takr: 0x116C0,
talu: 0x19D0,
tamldec: 0x0BE6,
telu: 0x0C66,
thai: 0x0E50,
tibt: 0x0F20
tibt: 0x0F20,
tirh: 0x114D0,
vaii: 0xA620,
wara: 0x118E0,
wcho: 0x1E2F0,
};

var options, formatter;
var s, zeroCode, digitList;
for (let [numberingSystem, digitList] of Object.entries(numberingSystems)) {
if (typeof digitList === 'number') {
let zeroCode = digitList;
digitList = [];
for (let i = 0; i <= 9; ++i) {
digitList[i] = zeroCode + i;
}
}

assert.sameValue(digitList.length, 10);

for (s in numberingSystems) {
zeroCode = numberingSystems[s];
if (typeof zeroCode === 'number') {
digitList = [zeroCode, zeroCode+1, zeroCode+2, zeroCode+3, zeroCode+4,
zeroCode+5, zeroCode+6, zeroCode+7, zeroCode+8, zeroCode+9];
numberingSystems[s] = digitList;
let nf = new Intl.NumberFormat(undefined, {numberingSystem});

for (let i = 0; i <= 9; ++i) {
assert.sameValue(nf.format(i), String.fromCodePoint(digitList[i]),
`numberingSystem: ${numberingSystem}, digit: ${i}`);
}
}

// FIXME: Unfinished

0 comments on commit 649d0d2

Please sign in to comment.