/// Tests for superscripts /// simple superscripts /// complex/nested superscripts use crate::common::*; #[test] fn squared() { let expr = " x 2 "; test("fi", "SimpleSpeak", expr, "x toiseen"); } #[test] fn cubed() { let expr = " x 3 "; test("fi", "SimpleSpeak", expr, "x kolmanteen"); } #[test] fn ordinal_power() { let expr = " x 4 "; test("fi", "SimpleSpeak", expr, "x potenssiin 4"); } #[test] fn simple_mi_power() { let expr = " x n "; test("fi", "SimpleSpeak", expr, "x potenssiin n"); } #[test] fn zero_power() { let expr = " x 0 "; test("fi", "SimpleSpeak", expr, "x potenssiin 0"); } #[test] fn decimal_period_power() { let expr = " x 2.0 "; test("fi", "SimpleSpeak", expr, "x potenssiin 2.0"); } #[test] fn decimal_comma_power() { let expr = " x 2,0 "; test("fi", "SimpleSpeak", expr, "x potenssiin 2,0"); } #[test] fn non_simple_power() { let expr = " 3 y+2 "; test("fi", "SimpleSpeak", expr, "3 potenssiin y plus 2"); } #[test] fn negative_power() { let expr = " x - 2 "; test("fi", "SimpleSpeak", expr, "x potenssiin negatiivinen 2"); } #[test] fn simple_fraction_power() { let expr = " x 13 "; test("fi", "SimpleSpeak", expr, "x potenssiin 1 kolmasosa"); } #[test] fn nested_squared_power_with_coef() { let expr = " 3 2 x 2 "; test("fi", "SimpleSpeak", expr, "3 potenssiin 2 x toiseen"); } #[test] fn nested_squared_power_with_neg_coef() { let expr = " 3 - 2 x 2 "; test("fi", "SimpleSpeak", expr, "3 potenssiin negatiivinen 2 x toiseen"); } #[test] fn nested_cubed_power() { let expr = " y 45 3 "; test("fi", "SimpleSpeak", expr, "y potenssiin 4 viidesosaa kolmanteen"); } #[test] fn nested_cubed_power_with_neg_base() { let expr = " y - 45 3 "; test("fi", "SimpleSpeak", expr, "y potenssiin negatiivinen 4 viidesosaa kolmanteen"); } #[test] fn nested_number_times_squared() { let expr = " e 1 2 x 2 "; test("fi", "SimpleSpeak", expr, "e potenssiin 1 kahdesosa x toiseen"); } #[test] fn nested_negative_number_times_squared() { let expr = " e 1 2 x 2 "; test("fi", "SimpleSpeak", expr, "e potenssiin negatiivinen 1 kahdesosa, x toiseen"); } #[test] fn nested_expr_to_tenth() { let expr = " 3 3 10 "; test("fi", "SimpleSpeak", expr, "3 potenssiin 3 potenssiin 10"); } #[test] fn nested_non_simple_squared_exp() { let expr = " 3 ( x+1 ) 2 "; test("fi", "SimpleSpeak", expr, "3 potenssiin auki sulku x plus 1, kiinni sulku toiseen"); } #[test] fn nested_simple_power() { let expr = " t 45 n "; test("fi", "SimpleSpeak", expr, "t potenssiin 4 viidesosaa potenssiin n"); } #[test] fn nested_end_exponent_power() { let expr = " t 45 n+1 "; test("fi", "SimpleSpeak", expr, "t potenssiin 4 viidesosaa potenssiin n plus 1, loppu potenssi"); } #[test] fn nested_end_exponent_neg_power() { let expr = " t 45 -3 "; test("fi", "SimpleSpeak", expr, "t potenssiin 4 viidesosaa potenssiin negatiivinen 3, loppu potenssi"); } #[test] fn nested_complex_power() { let expr = " e 1 2 ( xμ σ ) 2 "; test("fi", "SimpleSpeak", expr, "e potenssiin negatiivinen 1 kahdesosa, kertaa; auki sulku; murtoluku, x miinus myy, per sigma, loppu murtoluku; kiinni sulku toiseen"); } #[test] fn default_power() { let expr = " t b+1 3 "; test("fi", "SimpleSpeak", expr, "t potenssiin murtoluku, b plus 1, per 3, loppu murtoluku;"); }