fix: large number parser (ar)
This commit is contained in:
parent
fc7655093b
commit
f66dce9d3d
5 changed files with 15809 additions and 24 deletions
|
|
@ -245,14 +245,15 @@ pub fn entry(lang: Language) -> Entry {
|
|||
},
|
||||
comma_decimal: false,
|
||||
number_tokens: ::phf::Map {
|
||||
key: 12913932095322966823,
|
||||
key: 7485420634051515786,
|
||||
disps: &[
|
||||
(0, 0),
|
||||
],
|
||||
entries: &[
|
||||
("مليار", 9),
|
||||
("آلاف", 3),
|
||||
("مليون", 6),
|
||||
("ألف", 3),
|
||||
("مليار", 9),
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
|
|||
14
src/util.rs
14
src/util.rs
|
|
@ -383,6 +383,20 @@ mod tests {
|
|||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn t_parse_large_numstr_samples2() {
|
||||
let json_path = Path::new("testfiles/dict/large_number_samples_all.json");
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
let number_samples: BTreeMap<Language, BTreeMap<String, u64>> =
|
||||
serde_json::from_reader(BufReader::new(json_file)).unwrap();
|
||||
|
||||
number_samples.iter().for_each(|(lang, entry)| {
|
||||
entry.iter().for_each(|(txt, expect)| {
|
||||
testcase_parse_large_numstr(txt, *lang, *expect);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fn testcase_parse_large_numstr(string: &str, lang: Language, expect: u64) {
|
||||
// Round the expected number to the amount of significant digits included
|
||||
// in the string.
|
||||
|
|
|
|||
Reference in a new issue