/// 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("en", "SimpleSpeak", expr, "eigh grave, b tilde, c breve, b check, c grave; plus; \ x dot, y dot, z double dot, u triple dot, v quadruple dot; plus x hat, plus vector t"); } #[test] fn limit() { let expr = " lim x 0 sin x x "; test("en", "SimpleSpeak", expr, "the limit as x approaches 0, of, fraction, sine of x, over x, end fraction;"); } #[test] fn limit_from_below() { let expr = " lim x 0 sin x "; test("en", "SimpleSpeak", expr, "the limit as x approaches from below 0, of sine of x"); } #[test] fn binomial_mmultiscripts() { let expr = "Cmn"; test("en", "SimpleSpeak", expr, "n choose m"); } #[test] fn permutation_mmultiscripts() { let expr = "Pkn"; test("en", "SimpleSpeak", expr, "k permutations of n"); } #[test] fn permutation_mmultiscripts_sup() { let expr = "Pkn"; test("en", "SimpleSpeak", expr, "k permutations of n"); } #[test] fn permutation_msubsup() { let expr = "Pkn"; test("en", "SimpleSpeak", expr, "k permutations of n"); } #[test] fn tensor_mmultiscripts() { let expr = " R i j k l "; test_prefs("en", "SimpleSpeak", vec![("Verbosity", "Verbose")], expr, "cap r with 4 postscripts, subscript i superscript j subscript k subscript l"); test_prefs("en", "SimpleSpeak", vec![("Verbosity", "Medium")], expr, "cap r with 4 postscripts, sub i super j sub k sub l"); } #[test] fn huge_num_mmultiscripts() { let expr = " R i j k l m I J K L "; test_prefs("en", "SimpleSpeak", vec![("Verbosity", "Verbose")], expr, "cap r with 4 prescripts, pre subscript cap i, pre superscript cap j and alternating prescripts cap k none cap l none end prescripts and with 5 postscripts, subscript i superscript j subscript k subscript l and alternating scripts m none end scripts"); } #[test] fn prime() { let expr = " x "; test("en", "SimpleSpeak", expr, "x prime,"); } #[test] fn given() { let expr = "P(A|B)"; test("en", "SimpleSpeak", expr, "cap p, open paren, cap eigh vertical line cap b; close paren"); test("en", "ClearSpeak", expr, "cap p, open paren, cap eigh divides cap b, close paren"); // not good, but follows the spec } #[test] fn simple_msubsup() { let expr = " x k i "; test("en", "ClearSpeak", expr, "x sub k to the i-th power"); } #[test] fn presentation_mathml_in_semantics() { let expr = " {\\displaystyle x_k^i} x k i "; test("en", "ClearSpeak", expr, "x sub k to the i-th power"); } #[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("en", "SimpleSpeak", expr, "cap p; open paren, cap eigh and cap b; close paren; is equal to; cap p, open paren, cap eigh intersection cap b; close paren; is equal to, cap p of cap eigh, cap p of cap b"); } #[test] fn ignore_mtext_period() { let expr = "{2}."; test("en", "SimpleSpeak", expr, "the set 2"); } #[test] fn ignore_comma() { // from https://en.wikipedia.org/wiki/Probability let expr = " ϕ ( x ) = c e h 2 x 2 , "; test("en", "SimpleSpeak", expr, "phi of x is equal to; c, e raised to the negative h squared x squared power"); } #[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("en", "ClearSpeak", expr, "phi of x is equal to; c, e raised to the negative h squared x squared power"); } #[test] fn mn_with_space() { let expr = "1 234 567"; test("en", "SimpleSpeak", expr, "1234567"); }