/// Tests for rules shared between various speech styles: /// * modified var use crate::common::*; #[test] fn salt() { let expr = "NaCl"; test_prefs("sv", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "versal n a, versal c l,"); } #[test] fn water() { let expr = "H2O"; test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Terse")], expr, "versal h, 2 versal o,"); test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Medium")], expr, "versal h, nedsänkt 2, versal o,"); test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Verbose")], expr, "versal h, nedre index 2, versal o,"); } #[test] fn carbon() { let expr = "C"; // not enough to trigger recognition test_prefs("sv", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "versal c"); } #[test] fn sulfate() { let expr = " [SO4] 2 "; test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Medium")], expr, "start hak-parentes; versal s, versal o, nedsänkt 4; slut hak-parentes upphöjt 2 minus"); } #[test] fn aluminum_sulfate() { let expr = "Al2 (SO4)3"; test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Terse")], expr, "versal a l, 2; start-parentes; versal s, versal o, 4; slut-parentes 3"); test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Medium")], expr, "versal a l, nedsänkt 2; vänster-parentes; versal s, versal o, nedsänkt 4; höger-parentes nedsänkt 3"); test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Verbose")], expr, "versal a l, nedre index 2; vänster-parentes; versal s, versal o, nedre index 4; höger-parentes nedre index 3"); } #[test] fn ethanol_bonds() { let expr = " C H 3 C H 2 O H "; test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Terse")], expr, "versal c, versal h, 3 enkelbindning versal c, versal h, 2 enkelbindning versal o, versal h,"); } #[test] fn dichlorine_hexoxide() { let expr = " [ClO2] + [ClO4] - "; test_prefs("sv", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "start hak-parentes; versal c l, versal o, 2; slut hak-parentes plus; start hak-parentes; versal c l, versal o, 4; slut hak-parentes minus"); test_prefs("sv", "SimpleSpeak", vec![("Verbosity", "Medium")], expr, "start hak-parentes; versal c l, versal o, nedsänkt 2; slut hak-parentes upphöjt plus; start hak-parentes; versal c l, versal o, nedsänkt 4; slut hak-parentes upphöjt minus"); test_prefs("sv", "SimpleSpeak", vec![("Verbosity", "Verbose")], expr, "start hak-parentes; versal c l, versal o, nedre index 2; slut hak-parentes övre index plus; start hak-parentes; versal c l, versal o, nedre index 4; slut hak-parentes övre index minus"); } #[test] fn ethylene_with_bond() { let expr = " H2C = CH2 "; test_prefs("sv", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "versal h, 2 versal c, dubbelbindning versal c, versal h, 2"); } #[test] fn ferric_chloride_aq() { let expr = " Fe Cl3 (aq) "; test_prefs("sv", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "versal f e, versal c l, 3 vattenlösning,"); } #[test] fn ethylene_with_colon_bond() { let expr = " H2C :: CH2 "; test_prefs("sv", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "versal h, 2 versal c, dubbelbindning versal c, versal h, 2"); } #[test] fn beta_decay() { let expr = " C 6 14 N 7 14 + e 1 0 "; test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Terse")], expr, "14, 6, versal c; bildar, 14, 7, versal n; plus 0, minus 1, e,"); test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Medium")], expr, "upphöjt 14, nedsänkt 6, versal c; reaktion bildar; upphöjt 14, nedsänkt 7, versal n; plus, upphöjt 0, nedsänkt minus 1, e,"); test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Verbose")], expr, "övre index 14, nedre index 6, versal c; reaktion bildar; övre index 14, nedre index 7, versal n; plus, övre index 0, nedre index minus 1, e,"); } #[test] fn mhchem_beta_decay() { let expr = " A 6 14 A 2 6 2 14 C A 7 14 A 2 7 2 14 N + A 1 0 A 2 1 2 0 e "; test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Terse")], expr, "14, 6, versal c; bildar, 14, 7, versal n; plus 0, minus 1, e,"); test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Medium")], expr, "upphöjt 14, nedsänkt 6, versal c; reaktion bildar; upphöjt 14, nedsänkt 7, versal n; plus, upphöjt 0, nedsänkt minus 1, e,"); test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Verbose")], expr, "övre index 14, nedre index 6, versal c; reaktion bildar; övre index 14, nedre index 7, versal n; plus, övre index 0, nedre index minus 1, e,"); } #[test] fn hcl_na_yields() { let expr = " 2HCl+2Na 2NaCl+ H 2 "; test_prefs("sv", "SimpleSpeak", vec![("Verbosity", "Verbose")], expr, "2, versal h, versal c l; plus 2 versal n a; reaktion bildar; 2, versal n a, versal c l; plus versal h, nedre index 2"); } #[test] fn mhchem_so4_2plus() { let expr = " SO A 4 A 2 + "; test_prefs("sv", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "versal s; versal o, 4, 2 plus,"); test_prefs("sv", "SimpleSpeak", vec![("Verbosity", "Medium")], expr, "versal s; versal o, nedsänkt 4, upphöjt 2 plus,"); test_prefs("sv", "SimpleSpeak", vec![("Verbosity", "Verbose")], expr, "versal s; versal o, nedre index 4, övre index 2 plus,"); } #[test] fn mhchem_hcl_aq_etc() { let expr = " 2 HCl ( aq ) + 2 Na ( s ) 2 NaCl ( aq ) + H A 2 ( g ) "; test_prefs("sv", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "2, versal h, versal c l, vattenlösning; plus, 2, versal n a, fast; bildar; 2, versal n a, versal c l, vattenlösning; plus, versal h, 2; gas,"); } #[test] fn mhchem_barbed_equilibrium() { let expr = " H 2 ( g ) + I 2 ( g ) - - 2 H I ( g ) "; test_prefs("sv", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "versal h, 2; gas; plus; versal i, 2; gas; är i jämvikt med 2, versal h, versal i, gas,"); } #[test] fn mhchem_roman_in_superscript() { let expr = " Fe II Fe III O 4 "; test_prefs("sv", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "versal f e, 2; versal f e, 3; versal o, 4,"); }