/// Tests for rules shared between various speech styles: /// * modified var use crate::common::*; #[test] fn modified_vars() { let expr = " a ` b ~ c ̆ b ̌ c ` + x . y ˙ z ¨ u v + x ^ + t "; test("zh-tw", "SimpleSpeak", expr, "a grave, b tilde, c breve, b check, c grave; 加; \ x 點, y dot, z double dot, u triple dot, v quadruple dot; 加 x hat, 加 向量 t"); } #[test] fn limit() { let expr = " lim x 0 sin x x "; test("zh-tw", "SimpleSpeak", expr, "極限 x 趨近 0; 分數 x 分之, sine x 結束分數;"); } #[test] fn limit_from_below() { let expr = " lim x 0 sin x "; test("zh-tw", "SimpleSpeak", expr, "極限 x 從下方趨近 0; sine x"); } #[test] fn binomial_mmultiscripts() { let expr = "Cmn"; test("zh-tw", "SimpleSpeak", expr, "n 選 m"); } #[test] fn permutation_mmultiscripts() { let expr = "Pkn"; test("zh-tw", "SimpleSpeak", expr, "n 排列 k"); } #[test] fn permutation_mmultiscripts_sup() { let expr = "Pkn"; test("zh-tw", "SimpleSpeak", expr, "n 排列 k"); } #[test] fn permutation_msubsup() { let expr = "Pkn"; test("zh-tw", "SimpleSpeak", expr, "n 排列 k"); } #[test] fn tensor_mmultiscripts() { let expr = " R i j k l "; test_prefs("zh-tw", "SimpleSpeak", vec![("Verbosity", "Verbose")], expr, "大寫 r 有 4 後標, 下標 i 上標 j 下標 k 下標 l"); test_prefs("zh-tw", "SimpleSpeak", vec![("Verbosity", "Medium")], expr, "大寫 r 有 4 後標, 下標 i 上標 j 下標 k 下標 l"); } #[test] fn huge_num_mmultiscripts() { let expr = " R i j k l m I J K L "; test_prefs("zh-tw", "SimpleSpeak", vec![("Verbosity", "Verbose")], expr, "大寫 r 有 4 前標, 前下標 大寫 i, 前上標 大寫 j 與交替前標 大寫 k none 大寫 l none 結束前標 且 有 5 後標, 下標 i 上標 j 下標 k 下標 l 與交替後標 m none 結束後標"); } #[test] fn prime() { let expr = " x "; test("zh-tw", "SimpleSpeak", expr, "x prime,"); } #[test] fn given() { let expr = "P(A|B)"; test("zh-tw", "SimpleSpeak", expr, "大寫 p, 左小括, 大寫 a 垂線 大寫 b, 右小括"); } #[test] fn simple_msubsup() { let expr = " x k i "; test("zh-tw", "SimpleSpeak", expr, "x 下標 k, 的 i 次方"); } #[test] fn non_simple_msubsup() { let expr = "ij2k"; test("zh-tw", "SimpleSpeak", expr, "i 下標 j 減 2 結束下標, 的 k 次方"); } #[test] fn presentation_mathml_in_semantics() { let expr = " {\\displaystyle x_k^i} x k i "; test("zh-tw", "SimpleSpeak", expr, "x 下標 k, 的 i 次方"); } #[test] fn ignore_period() { // from https://en.wikipedia.org/wiki/Probability let expr = " {\\displaystyle x_k^i} P ( A  and  B ) = P ( A B ) = P ( A ) P ( B ) . "; test("zh-tw", "SimpleSpeak", expr, "大寫 p; 左小括, 大寫 a and 大寫 b; 右小括; 等於; 大寫 p, 左小括, 大寫 a 交集 大寫 b, 右小括; 等於, 大寫 p 大寫 a, 大寫 p 大寫 b"); } #[test] fn ignore_mtext_period() { let expr = "{2}."; test("zh-tw", "SimpleSpeak", expr, "集合 2"); } #[test] fn ignore_comma() { // from https://en.wikipedia.org/wiki/Probability let expr = " ϕ ( x ) = c e h 2 x 2 , "; test("zh-tw", "SimpleSpeak", expr, "phi x 等於, c, e 的 負 h 平方 x 平方 次方"); } #[test] #[ignore] // issue #14 fn ignore_period_and_space() { // from https://en.wikipedia.org/wiki/Probability let expr = " P ( A B ) = P ( A B ) P ( B ) . "; test("zh-tw", "SimpleSpeak", expr, "大寫 p, 左小括, 大寫 a 垂線 大寫 b, 右小括; 等於; 分數 大寫 p 大寫 b, 分之, 大寫 p, 左小括, 大寫 a 交集 大寫 b, 右小括 結束分數; 點"); } #[test] fn mn_with_space() { let expr = "1 234 567"; test("zh-tw", "SimpleSpeak", expr, "1234567"); }