/// 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("zh-tw", "SimpleSpeak", expr, "sine x 加 cosine y 加 tangent z 加 secant alpha, 加 cosecant phi, 加 cotangent phi"); } #[test] fn hyperbolic_trig_names() { let expr = " sinhx+ coshy+ tanhz+ sechα+ cschϕ+ cothφ "; test("zh-tw", "SimpleSpeak", expr, "hyperbolic sine x, 加 \ hyperbolic cosine y, 加 \ hyperbolic tangent z, 加 \ hyperbolic secant alpha, 加 \ hyperbolic cosecant phi, 加 \ hyperbolic cotangent, phi"); } #[test] fn inverse_trig() { let expr = "sin-1x"; test("zh-tw", "SimpleSpeak", expr, "反 sine x"); } #[test] fn trig_squared() { let expr = "sin2x"; test("zh-tw", "SimpleSpeak", expr, "sine 平方 x"); } #[test] fn trig_cubed() { let expr = "tan3x"; test("zh-tw", "SimpleSpeak", expr, "tangent 立方 x"); } #[test] fn trig_fourth() { let expr = "sec4x"; test("zh-tw", "SimpleSpeak", expr, "secant 的 4 次方; x"); } #[test] fn trig_power_other() { let expr = "sinh>n-1x"; test("zh-tw", "SimpleSpeak", expr, "hyperbolic sine 的 n 減 1 次方; x"); } #[test] fn simple_log() { let expr = " logx "; test("zh-tw", "SimpleSpeak", expr, "log x"); } #[test] fn normal_log() { let expr = "log(x+y)"; test("zh-tw", "SimpleSpeak", expr, "log, 左小括 x 加 y 右小括"); } #[test] fn simple_log_with_base() { let expr = " logbx "; test("zh-tw", "SimpleSpeak", expr, "log 底 b x"); } #[test] fn normal_log_with_base() { let expr = "logb(x+y)"; test("zh-tw", "SimpleSpeak", expr, "log 底 b, 左小括 x 加 y 右小括"); } #[test] fn simple_ln() { let expr = " lnx "; test("zh-tw", "SimpleSpeak", expr, "l n x"); } #[test] fn normal_ln() { let expr = "ln(x+y)"; test("zh-tw", "SimpleSpeak", expr, "l n, 左小括 x 加 y 右小括"); } #[test] fn normal_ln_terse() { let expr = "ln(x+y)"; test_prefs("zh-tw", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "l n, 左小括 x 加 y 右小括"); } #[test] fn simple_ln_terse() { let expr = " lnx "; test_prefs("zh-tw", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "l n x"); } #[test] fn explicit_function_call_with_parens() { let expr = "t(x)"; test("zh-tw", "SimpleSpeak", expr, "t x"); } #[test] fn explicit_times_with_parens() { let expr = "t(x)"; test("zh-tw", "SimpleSpeak", expr, "t 乘 x"); } #[test] fn explicit_function_call() { let expr = "tx"; test("zh-tw", "SimpleSpeak", expr, "t x"); } #[test] fn explicit_times() { let expr = "tx"; test("zh-tw", "SimpleSpeak", expr, "t x"); } /* * Tests for times */ #[test] fn no_times_binomial() { let expr = "x y"; test("zh-tw", "SimpleSpeak", expr, "x y"); } #[test] fn times_following_paren() { let expr = " 2 ( 3 ) "; test("zh-tw", "SimpleSpeak", expr, "2 乘 3"); } #[test] fn times_preceding_paren() { let expr = " ( 2 ) 3 "; test("zh-tw", "SimpleSpeak", expr, "2 乘 3"); } #[test] fn no_times_sqrt() { let expr = " a b = ab "; test("zh-tw", "SimpleSpeak", expr, "根號 a, 根號 b; 等於, 根號 a b 結束根號;"); } /* * Tests for parens */ #[test] fn no_parens_number() { let expr = " ( 25 ) x "; test("zh-tw", "SimpleSpeak", expr, "25 乘 x"); } #[test] fn no_parens_monomial() { let expr = " b ( xy ) "; test("zh-tw", "SimpleSpeak", expr, "b x y"); } #[test] fn no_parens_negative_number() { let expr = " 2+ ( 2 ) "; test("zh-tw", "SimpleSpeak", expr, "2 加 負 2"); } #[test] fn no_parens_negative_number_with_var() { let expr = " ( 2x ) +1 "; test("zh-tw", "SimpleSpeak", expr, "負 2 x 加 1"); } #[test] fn parens_superscript() { let expr = " ( 2x ) 2 "; test("zh-tw", "SimpleSpeak", expr, "左小括 2 x 右小括 平方"); } #[test] fn no_parens_fraction() { let expr = " 2 + ( 12 ) "; test("zh-tw", "SimpleSpeak", expr, "2 加 2 分之 1"); } // Tests for the four types of intervals in SimpleSpeak #[test] fn parens_interval_open_open() { let expr = " ( (c,d) ) "; ///// mysterious intent test("zh-tw", "SimpleSpeak",expr, "開區間 c 逗號 d"); } #[test] fn parens_interval_closed_open() { let expr = " [ [(]c,d) ) "; test("zh-tw", "SimpleSpeak",expr, "閉開區間 c 逗號 d"); } #[test] fn parens_interval_open_closed() { let expr = " ( (c,d] ] "; test("zh-tw", "SimpleSpeak",expr,"開閉區間 c 逗號 d"); } #[test] fn parens_interval_closed_closed() { let expr = " [ [(]c,d] ] "; test("zh-tw", "SimpleSpeak",expr, "閉區間 c 逗號 d"); } #[test] fn parens_interval_neg_infinity_open_open() { let expr = " ( - ,d) ) "; test("zh-tw", "SimpleSpeak",expr, "開區間 負 無限大 逗號 d"); } #[test] fn parens_interval_neg_infinity_open_closed() { let expr = " ( - ,d] ] "; test("zh-tw", "SimpleSpeak",expr, "開閉區間 負 無限大 逗號 d"); }