MCPcopy Create free account
hub / github.com/daisy/MathCAT / test_prefs

Function test_prefs

tests/common/mod.rs:70–86  ·  view source on GitHub ↗
(language: &str, speech_style: &str, test_prefs: Vec<(&str, &str)>, mathml: &str, speech: &str)

Source from the content-addressed store, hash-verified

68#[allow(dead_code)] // used in testing
69#[allow(non_snake_case)]
70pub fn test_prefs(language: &str, speech_style: &str, test_prefs: Vec<(&str, &str)>, mathml: &str, speech: &str) {
71 set_rules_dir(abs_rules_dir_path()).unwrap();
72 libmathcat::speech::SPEECH_RULES.with(|rules| {
73 let rules = rules.borrow_mut();
74 let mut prefs = rules.pref_manager.borrow_mut();
75 prefs.set_user_prefs("SpeechOverrides_CapitalLetters", ""); // makes testing simpler
76 prefs.set_user_prefs("PauseFactor", "100"); // makes testing simpler
77 prefs.set_user_prefs("Verbosity", "Medium");
78 });
79
80 set_preference("Language".to_string(), language.to_string()).unwrap();
81 set_preference("SpeechStyle".to_string(), speech_style.to_string()).unwrap();
82 for (pref_name, pref_value) in test_prefs.clone() {
83 set_preference(pref_name.to_string(), pref_value.to_string()).unwrap();
84 };
85 check_answer(mathml, speech, &format!("{}/{} with prefs {:#?}", language, speech_style, test_prefs));
86}
87
88// Compare the result of speaking the mathml input to the output 'speech'
89// This forces the use of ClearSpeak and sets a single ClearSpeak preference

Callers 15

test_ClearSpeakFunction · 0.70
test_ClearSpeak_prefsFunction · 0.70
saltFunction · 0.50
waterFunction · 0.50
carbonFunction · 0.50
sulfateFunction · 0.50
aluminum_sulfateFunction · 0.50
ethanol_bondsFunction · 0.50
dichlorine_hexoxideFunction · 0.50
ethylene_with_bondFunction · 0.50
ferric_chloride_aqFunction · 0.50
ethylene_with_colon_bondFunction · 0.50

Calls 5

set_rules_dirFunction · 0.85
set_preferenceFunction · 0.85
check_answerFunction · 0.85
set_user_prefsMethod · 0.80
abs_rules_dir_pathFunction · 0.70

Tested by

no test coverage detected