use crate::math_symbol_shortcut;
pub fn is_sequence_brace(c: char) -> bool {
matches!(c, '{' | '}')
}
pub fn encode_sequence_brace(c: char, result: &mut Vec<u8>) -> Result<(), String> {
math_symbol_shortcut::encode_char_math_symbol_shortcut(c)
.map(|encoded| result.extend_from_slice(encoded))
}
#[cfg(test)]
mod tests {
use super::*;
fn is_sequence_notation_char(c: char) -> bool {
is_sequence_brace(c) || c == '\u{2099}'
}
#[test]
fn detects_sequence_braces() {
assert!(is_sequence_brace('{'));
assert!(is_sequence_brace('}'));
}
#[test]
fn detects_sequence_notation_chars() {
assert!(is_sequence_notation_char('{'));
assert!(is_sequence_notation_char('}'));
assert!(is_sequence_notation_char('\u{2099}')); assert!(!is_sequence_notation_char('a'));
}
}