Functional Weave
Code in Python

money.currency-digits@1.0.0

vectors.json

1,093 bytes · view raw

[
  { "name": "pound sterling has two", "args": ["GBP"], "expect": 2 },
  { "name": "euro has two", "args": ["EUR"], "expect": 2 },
  { "name": "US dollar has two", "args": ["USD"], "expect": 2 },
  { "name": "yen has none", "args": ["JPY"], "expect": 0 },
  { "name": "won has none", "args": ["KRW"], "expect": 0 },
  { "name": "Icelandic krona has none", "args": ["ISK"], "expect": 0 },
  { "name": "Kuwaiti dinar has three", "args": ["KWD"], "expect": 3 },
  { "name": "Bahraini dinar has three", "args": ["BHD"], "expect": 3 },
  { "name": "Chilean Unidad de Fomento has four", "args": ["CLF"], "expect": 4 },
  { "name": "Hungarian forint is two under ISO 4217", "args": ["HUF"], "expect": 2 },
  { "name": "CFA franc has none", "args": ["XOF"], "expect": 0 },
  { "name": "gold has no minor unit and is an error", "args": ["XAU"], "expectError": "no ISO 4217 minor unit" },
  { "name": "lowercase is not matched", "args": ["gbp"], "expectError": "no ISO 4217 minor unit" },
  { "name": "an unknown code is an error, not two", "args": ["XYZ"], "expectError": "no ISO 4217 minor unit" }
]