Skip to content

Commit

Permalink
Add a test for a match opcode with character sets
Browse files Browse the repository at this point in the history
  • Loading branch information
egli committed Dec 24, 2024
1 parent 904ae5f commit 166a4c1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/translator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -742,4 +742,20 @@ mod tests {
assert_eq!(table.translate("afoob"), "⠁⠉⠂");
assert_eq!(table.translate("ffoob"), "⠄⠉⠂");
}

#[test]
fn match_with_set_test() {
let rules = vec![
parse_rule("lowercase f 3"),
parse_rule("lowercase o 4"),
parse_rule("lowercase s 7"),
parse_rule("lowercase z 5"),
parse_rule("match [fz] oo [fz] 14"),
];
let table = TranslationTable::compile(rules, Direction::Forward).unwrap();
assert_eq!(table.translate("oo"), "⠈⠈");
assert_eq!(table.translate("soo"), "⡀⠈⠈");
assert_eq!(table.translate("foof"), "⠄⠉⠄");
assert_eq!(table.translate("zoof"), "⠐⠉⠄");
}
}

0 comments on commit 166a4c1

Please sign in to comment.