/// Tests for rules shared between various speech styles: /// * modified var use crate::common::*; #[test] fn salt() { let expr = "NaCl"; test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "iso n a, iso c l,"); } #[test] fn water() { let expr = "H2O"; test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Terse")], expr, "iso h, 2 iso o,"); test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Medium")], expr, "iso h, ala 2 iso o,"); test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Verbose")], expr, "iso h, alaindeksi 2, iso o,"); } #[test] fn carbon() { let expr = "C"; // not enough to trigger recognition test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "iso c"); } #[test] fn sulfate() { let expr = " [SO4] 2 "; test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Medium")], expr, "auki hakasulku, iso s, iso o, ala 4; kiinni hakasulku ylä 2 miinus"); } #[test] fn aluminum_sulfate() { let expr = "Al2 (SO4)3"; test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Terse")], expr, "iso a l, 2, auki iso s, iso o, 4, kiinni 3"); test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Medium")], expr, "iso a l, ala 2; auki sulku, iso s, iso o, ala 4; kiinni sulku ala 3"); test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Verbose")], expr, "iso a l, alaindeksi 2; auki sulku, iso s, iso o, alaindeksi 4; kiinni sulku alaindeksi 3"); } #[test] fn ethanol_bonds() { let expr = " C H 3 C H 2 O H "; test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Terse")], expr, "iso c, iso h, 3 yksinkertainen sidos, iso c, iso h, 2 yksinkertainen sidos, iso o, iso h,"); } #[test] fn dichlorine_hexoxide() { let expr = " [ClO2] + [ClO4] - "; test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "auki hakasulku, iso c l, iso o, 2; kiinni hakasulku plus; auki hakasulku, iso c l, iso o, 4; kiinni hakasulku miinus"); test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Medium")], expr, "auki hakasulku, iso c l, iso o, ala 2; kiinni hakasulku ylä plus; auki hakasulku, iso c l, iso o, ala 4; kiinni hakasulku ylä miinus"); test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Verbose")], expr, "auki hakasulku, iso c l, iso o, alaindeksi 2; kiinni hakasulku yläindeksi plus; auki hakasulku, iso c l, iso o, alaindeksi 4; kiinni hakasulku yläindeksi miinus"); } #[test] fn ethylene_with_bond() { let expr = " H2C = CH2 "; test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "iso h, 2 iso c, kaksinkertainen sidos, iso c, iso h, 2"); } #[test] fn ferric_chloride_aq() { let expr = " Fe Cl3 (aq) "; test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "iso f e, iso c l, 3 vesiliuoksessa,"); } #[test] fn ethylene_with_colon_bond() { let expr = " H2C :: CH2 "; test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "iso h, 2 iso c, kaksinkertainen sidos, iso c, iso h, 2"); } #[test] fn beta_decay() { let expr = " C 6 14 N 7 14 + e 1 0 "; test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Terse")], expr, "14, 6, iso c; muodostaa; 14, 7, iso n; plus 0, negatiivinen 1, e,"); test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Medium")], expr, "ylä 14, ala 6, iso c; reagoi; ylä 14, ala 7, iso n; plus, ylä 0, ala negatiivinen 1, e,"); test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Verbose")], expr, "yläindeksi 14, alaindeksi 6, iso c; reagoi; yläindeksi 14, alaindeksi 7, iso n; plus, yläindeksi 0, alaindeksi negatiivinen 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("fi", "ClearSpeak", vec![("Verbosity", "Terse")], expr, "14, 6, iso c; muodostaa; 14, 7, iso n; plus 0, negatiivinen 1, e,"); test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Medium")], expr, "ylä 14, ala 6, iso c; reagoi; ylä 14, ala 7, iso n; plus, ylä 0, ala negatiivinen 1, e,"); test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Verbose")], expr, "yläindeksi 14, alaindeksi 6, iso c; reagoi; yläindeksi 14, alaindeksi 7, iso n; plus, yläindeksi 0, alaindeksi negatiivinen 1, e,"); } #[test] fn hcl_na_yields() { let expr = " 2HCl+2Na 2NaCl+ H 2 "; test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Verbose")], expr, "2, iso h, iso c l; plus 2 iso n a; reagoi; 2, iso n a, iso c l; plus iso h, alaindeksi 2"); } #[test] fn mhchem_so4_2plus() { let expr = " SO A 4 A 2 + "; test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "iso s; iso o, 4, 2 plus,"); test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Medium")], expr, "iso s; iso o, ala 4, ylä 2 plus,"); test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Verbose")], expr, "iso s; iso o, alaindeksi 4, yläindeksi 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("fi", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "2, iso h, iso c l, vesiliuoksessa; plus, 2, iso n a, kiinteä; muodostaa; 2, iso n a, iso c l, vesiliuoksessa; plus, iso h, 2, kaasu,"); } #[test] fn mhchem_barbed_equilibrium() { let expr = " H 2 ( g ) + I 2 ( g ) - - 2 H I ( g ) "; test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "iso h, 2, kaasu; plus; iso i, 2, kaasu; on tasapainossa 2, iso h, iso i, kaasu,"); } #[test] fn mhchem_roman_in_superscript() { let expr = " Fe II Fe III O 4 "; test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "iso f e, 2; iso f e, 3; iso o, 4,"); }