/// 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("fi", "SimpleSpeak", expr, "sini arvolla x, plus kosini arvolla y, plus tangentti arvolla z, plus sekantti arvolla alfa, plus, kosekantti arvolla suora fii, plus kotangentti arvolla fii"); } #[test] fn hyperbolic_trig_names() { let expr = " sinhx+ coshy+ tanhz+ sechα+ cschϕ+ cothφ "; test("fi", "SimpleSpeak", expr, "hyperbolinen sini arvolla x, plus, hyperbolinen kosini arvolla y, plus, hyperbolinen tangentti, arvolla z, plus, hyperbolinen sekantti, arvolla alfa; plus, hyperbolinen kosekantti, arvolla suora fii; plus, hyperbolinen kotangentti, arvolla fii"); } #[test] fn inverse_trig() { let expr = "sin-1x"; test("fi", "SimpleSpeak", expr, "käänteis sini arvolla x"); } #[test] fn trig_squared() { let expr = "sin2x"; test("fi", "SimpleSpeak", expr, "sini toiseen arvolla x"); } #[test] fn trig_cubed() { let expr = "tan3x"; test("fi", "SimpleSpeak", expr, "tangentti kolmanteen arvolla x"); } #[test] fn trig_fourth() { let expr = "sec4x"; test("fi", "SimpleSpeak", expr, "sekantti potenssiin 4, arvolla x"); } #[test] fn trig_power_other() { let expr = "sinh>n-1x"; test("fi", "SimpleSpeak", expr, "hyperbolinen sini potenssiin n miinus 1; arvolla x"); } #[test] fn simple_log() { let expr = " logx "; test("fi", "SimpleSpeak", expr, "log x"); } #[test] fn normal_log() { let expr = "log(x+y)"; test("fi", "SimpleSpeak", expr, "log, auki sulku x plus y, kiinni sulku"); } #[test] fn simple_lg() { let expr = " lgx "; test("fi", "SimpleSpeak", expr, "kymmenkantainen logaritmi x"); test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "l g x"); } #[test] fn normal_lg() { let expr = "lg(x+y)"; test("fi", "SimpleSpeak", expr, "l g, auki sulku x plus y, kiinni sulku"); test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "l g, auki x plus y kiinni"); } #[test] fn simple_log_with_base() { let expr = " logbx "; test("fi", "SimpleSpeak", expr, "log kanta b arvolla x"); } #[test] fn normal_log_with_base() { let expr = "logb(x+y)"; test("fi", "SimpleSpeak", expr, "log kanta b arvolla, auki sulku x plus y, kiinni sulku"); } #[test] fn simple_ln() { let expr = " lnx "; test("fi", "SimpleSpeak", expr, "luonnollinen log x"); } #[test] fn normal_ln() { let expr = "ln(x+y)"; test("fi", "SimpleSpeak", expr, "luonnollinen logaritmi, auki sulku x plus y, kiinni sulku"); } #[test] fn normal_ln_terse() { let expr = "ln(x+y)"; test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "l n, auki x plus y kiinni"); } #[test] fn simple_ln_terse() { let expr = " lnx "; test_prefs("fi", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "l n x"); } #[test] fn explicit_function_call_with_parens() { let expr = "t(x)"; test("fi", "SimpleSpeak", expr, "t arvolla x"); } #[test] fn explicit_times_with_parens() { let expr = "t(x)"; test("fi", "SimpleSpeak", expr, "t kertaa x"); } #[test] fn explicit_function_call() { let expr = "tx"; test("fi", "SimpleSpeak", expr, "t arvolla x"); } #[test] fn explicit_times() { let expr = "tx"; test("fi", "SimpleSpeak", expr, "t x"); } /* * Tests for times */ #[test] fn no_times_binomial() { let expr = "x y"; test("fi", "SimpleSpeak", expr, "x y"); } #[test] fn times_following_paren() { let expr = " 2 ( 3 ) "; test("fi", "SimpleSpeak", expr, "2 kertaa 3"); } #[test] fn times_preceding_paren() { let expr = " ( 2 ) 3 "; test("fi", "SimpleSpeak", expr, "2 kertaa 3"); } #[test] fn no_times_sqrt() { let expr = " a b = ab "; test("fi", "SimpleSpeak", expr, "neliöjuuri a, neliöjuuri b; on yhtä suuri kuin, neliöjuuri a b loppu juuri,"); } /* * Tests for parens */ #[test] fn no_parens_number() { let expr = " ( 25 ) x "; test("fi", "SimpleSpeak", expr, "25 kertaa x"); } #[test] fn no_parens_monomial() { let expr = " b ( xy ) "; test("fi", "SimpleSpeak", expr, "b x y"); } #[test] fn no_parens_negative_number() { let expr = " 2+ ( 2 ) "; test("fi", "SimpleSpeak", expr, "2 plus negatiivinen 2"); } #[test] fn no_parens_negative_number_with_var() { let expr = " ( 2x ) +1 "; test("fi", "SimpleSpeak", expr, "negatiivinen 2 x, plus 1"); } #[test] fn parens_superscript() { let expr = " ( 2x ) 2 "; test("fi", "SimpleSpeak", expr, "auki sulku 2 x kiinni sulku toiseen"); } #[test] fn no_parens_fraction() { let expr = " 2 + ( 12 ) "; test("fi", "SimpleSpeak", expr, "2 plus 1 kahdesosa"); } // Tests for the four types of intervals in SimpleSpeak #[test] fn parens_interval_open_open() { let expr = " ( (c,d) ) "; test("fi", "SimpleSpeak",expr, "avoin väli luvusta c lukuun d"); } #[test] fn parens_interval_closed_open() { let expr = " [ [(]c,d) ) "; test("fi", "SimpleSpeak",expr, "oikealta puoliavoin väli luvusta c lukuun d"); } #[test] fn parens_interval_open_closed() { let expr = " ( (c,d] ] "; test("fi", "SimpleSpeak",expr,"vasemmalta puoliavoin väli luvusta c lukuun d"); } #[test] fn parens_interval_closed_closed() { let expr = " [ [(]c,d] ] "; test("fi", "SimpleSpeak",expr, "suljettu väli luvusta c lukuun d"); } #[test] fn parens_interval_neg_infinity_open_open() { let expr = " ( - ,d) ) "; test("fi", "SimpleSpeak",expr, "avoin väli luvusta negatiivinen ääretön lukuun d"); } #[test] fn parens_interval_neg_infinity_open_closed() { let expr = " ( - ,d] ] "; test("fi", "SimpleSpeak",expr, "vasemmalta puoliavoin väli luvusta negatiivinen ääretön lukuun d"); }