/// Tests for: /// * functions including trig functions, logs, and functions to powers /// * implied times/functional call and explicit times/function call /// * parens /// These are all intertwined, so they are in one file use crate::common::*; #[test] fn trig_names() { let expr = " sinx+ cosy+ tanz+ secα+ cscϕ+ cotφ "; test("es", "SimpleSpeak", expr, "seno de x más coseno de y más tangente de z más secante de alpha, más cosecante de phi, más cotangente de phi"); } #[test] fn hyperbolic_trig_names() { let expr = " sinhx+ coshy+ tanhz+ sechα+ cschϕ+ cothφ "; test("es", "SimpleSpeak", expr, "seno hipervólico de x, más \ coseno hipervólico de y, más \ tangente hipervólica de z, más \ secante hipervólica de alpha, más \ cosecante hipervólica de phi, más \ cotangente hipervólica de phi"); } #[test] fn inverse_trig() { let expr = "sin-1x"; test("es", "SimpleSpeak", expr, "seno inverso de x"); } #[test] fn trig_squared() { let expr = "sin2x"; test("es", "SimpleSpeak", expr, "seno al cuadrado de x"); } #[test] fn trig_cubed() { let expr = "tan3x"; test("es", "SimpleSpeak", expr, "tangente al cubo de x"); } #[test] fn trig_fourth() { let expr = "sec4x"; test("es", "SimpleSpeak", expr, "la cuarta potencia de, secante de x"); } #[test] fn trig_power_other() { let expr = "sinh>n-1x"; test("es", "SimpleSpeak", expr, "la potencia n menos 1 , seno hipervólico de x"); } #[test] fn simple_log() { let expr = " logx "; test("es", "SimpleSpeak", expr, "logaritmo de x"); } #[test] fn normal_log() { let expr = "log(x+y)"; test("es", "SimpleSpeak", expr, "el logaritmo de, se abren paréntesis x más y, se cierran paréntesis"); } #[test] fn simple_log_with_base() { let expr = " logbx "; test("es", "SimpleSpeak", expr, "el logaritmo en base b de x"); } #[test] fn normal_log_with_base() { let expr = "logb(x+y)"; test("es", "SimpleSpeak", expr, "el logaritmo en base b de, se abren paréntesis x más y, se cierran paréntesis"); } #[test] fn simple_ln() { let expr = " lnx "; test("es", "SimpleSpeak", expr, "logaritmo natural de x"); } #[test] fn normal_ln() { let expr = "ln(x+y)"; test("es", "SimpleSpeak", expr, "el logaritmo natural de, se abren paréntesis x más y, se cierran paréntesis"); } #[test] fn normal_ln_terse() { let expr = "ln(x+y)"; test_prefs("es", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "l n de x, apertura x más y cierre"); } #[test] fn simple_ln_terse() { let expr = " lnx "; test_prefs("es", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "l n de x"); } #[test] fn explicit_function_call_with_parens() { let expr = "t(x)"; test("es", "SimpleSpeak", expr, "t de x"); } #[test] fn explicit_times_with_parens() { let expr = "t(x)"; test("es", "SimpleSpeak", expr, "t veces x"); } #[test] fn explicit_function_call() { let expr = "tx"; test("es", "SimpleSpeak", expr, "t de x"); } #[test] fn explicit_times() { let expr = "tx"; test("es", "SimpleSpeak", expr, "t x"); } /* * Tests for times */ #[test] fn no_times_binomial() { let expr = "x y"; test("es", "SimpleSpeak", expr, "x y"); } #[test] fn times_following_paren() { let expr = " 2 ( 3 ) "; test("es", "SimpleSpeak", expr, "2 veces 3"); } #[test] fn times_preceding_paren() { let expr = " ( 2 ) 3 "; test("es", "SimpleSpeak", expr, "2 veces 3"); } #[test] fn no_times_sqrt() { let expr = " a b = ab "; test("es", "SimpleSpeak", expr, "la raíz cuadrada de 8; la raíz cuadrada de b; es igual a, la raíz cuadrada de 8 b fin de raíz"); } /* * Tests for parens */ #[test] fn no_parens_number() { let expr = " ( 25 ) x "; test("es", "SimpleSpeak", expr, "25 veces x"); } #[test] fn no_parens_monomial() { let expr = " b ( xy ) "; test("es", "SimpleSpeak", expr, "b x y"); } #[test] fn no_parens_negative_number() { let expr = " 2+ ( 2 ) "; test("es", "SimpleSpeak", expr, "2 más menos 2"); } #[test] fn no_parens_negative_number_with_var() { let expr = " ( 2x ) +1 "; test("es", "SimpleSpeak", expr, "menos 2 x, más 1"); } #[test] fn parens_superscript() { let expr = " ( 2x ) 2 "; test("es", "SimpleSpeak", expr, "se abren paréntesis 2 x se cierran paréntesis al cuadrado"); } #[test] fn no_parens_fraction() { let expr = " 2 + ( 12 ) "; test("es", "SimpleSpeak", expr, "2 más 1 partido por 2"); } // Tests for the four types of intervals in SimpleSpeak #[test] fn parens_interval_open_open() { let expr = " ( (c,d) ) "; test("es", "SimpleSpeak",expr, "el intervalo abierto de c a d"); } #[test] fn parens_interval_closed_open() { let expr = " [ [(]c,d) ) "; test("es", "SimpleSpeak",expr, "el intervalo cerrado abierto de c a d"); } #[test] fn parens_interval_open_closed() { let expr = " ( (c,d] ] "; test("es", "SimpleSpeak",expr,"el intervalo abierto cerrado de c a d"); } #[test] fn parens_interval_closed_closed() { let expr = " [ [(]c,d] ] "; test("es", "SimpleSpeak",expr, "el intervalo cerrado de c a d"); } #[test] fn parens_interval_neg_infinity_open_open() { let expr = " ( - ,d) ) "; test("es", "SimpleSpeak",expr, "el intervalo abierto de menos infinito a d"); } #[test] fn parens_interval_neg_infinity_open_closed() { let expr = " ( - ,d] ] "; test("es", "SimpleSpeak",expr, "el intervalo abierto cerrado de menos infinito a d"); }