"#;
let result = parse_ssml(ssml).unwrap();
assert_eq!(
result.get_text().trim(),
r#"Here are SSML samples. I can pause . I can play a sound didn't get your MP3 audio file. I can speak in cardinals. Your number is 10. Or I can speak in ordinals. You are 10 in line. Or I can even speak in digits. The digits for ten are 10. I can also substitute phrases, like the W3C. Finally, I can speak a paragraph with two sentences. This is sentence one. This is sentence two."#
);
// todo!();
}
#[test]
fn microsoft_custom_tags() {
// I've had to modify the Microsoft example as:
// 1. It was invalid XML (closing an already closed tag)
// 2. Invalid parameter values that don't match the standard
let ssml = r#""#;
let result = parse_ssml(ssml).unwrap();
assert_eq!(result.get_text().trim(), "");
let tags: Vec = {
use SsmlElement::*;
vec![
Speak,
Custom("mstts:backgroundaudio".to_string()),
Voice,
Audio,
Custom("bookmark".to_string()),
Break,
Emphasis,
Lang,
Lexicon,
Custom("math".to_string()),
Custom("mstts:express-as".to_string()),
Custom("mstts:silence".to_string()),
Custom("mstts:viseme".to_string()),
Paragraph,
Phoneme,
Prosody,
Sentence,
SayAs,
Sub,
]
};
for (parsed, expected) in result.tags().zip(tags.iter()) {
let actual_tag = SsmlElement::from(&parsed.element);
assert_eq!(actual_tag, *expected);
if let ParsedElement::Break(b) = &parsed.element {
assert_eq!(b.strength, Some(Strength::Medium));
assert_eq!(b.time, Some(TimeDesignation::Seconds(5.0)));
} else if let ParsedElement::Phoneme(p) = &parsed.element {
assert_eq!(
p.alphabet.as_ref().unwrap(),
&PhonemeAlphabet::Other("string".to_string())
);
assert_eq!(p.ph, "string");
}
}
}