Skip to content
This repository has been archived by the owner on May 29, 2022. It is now read-only.

Commit

Permalink
Add more tests and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aslamplr committed Mar 10, 2020
1 parent f34d42f commit c380e7d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ pub fn convert_to_mltt(
for key in combinators {
if let Some(value) = map.get(&key) {
while let Some(index) = text_to_convert.find(&key) {
let middle_char = get_prev_char(&text_to_convert, index);
let mid_val = map.get(&format!("{}", middle_char)).unwrap();
let middle_char = get_prev_char(&text_to_convert, index).to_string();
let mid_val = map.get(&middle_char).unwrap_or(&middle_char);
let split_val = value.split("").collect::<Vec<_>>();
let new_key = format!("{}{}", middle_char, key);
let new_val = format!("{}{}{}", split_val[1], mid_val, split_val[2]);
Expand Down
32 changes: 32 additions & 0 deletions tests/convertion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,38 @@ fn convert_case_short_8() -> Result<(), Box<dyn Error>> {
)
}

#[test]
fn convert_case_short_9() -> Result<(), Box<dyn Error>> {
test_convertion(
r#"പൊടുന്നനെ"#,
r#"s]mSp¶s\"#
)
}

#[test]
fn convert_case_short_10() -> Result<(), Box<dyn Error>> {
test_convertion(
r#"കിളികൊല്ലൂർ"#,
r#"InfnsImÃqÀ"#
)
}

#[test]
fn convert_case_short_11() -> Result<(), Box<dyn Error>> {
test_convertion(
r#"കോയമ്പത്തൂർ"#,
r#"tImb¼¯qÀ"#
)
}

#[test]
fn convert_case_short_12() -> Result<(), Box<dyn Error>> {
test_convertion(
r#"മുക്കോലയ്ക്കൽ"#,
r#"apt¡mebv¡Â"#
)
}

#[test]
fn convert_case_long_1() -> Result<(), Box<dyn Error>> {
test_convertion(
Expand Down

0 comments on commit c380e7d

Please sign in to comment.