/// Tests for superscripts /// simple superscripts /// complex/nested superscripts use crate::common::*; #[test] fn squared() { let expr = " x 2 "; test("sv", "SimpleSpeak", expr, "x kvadrat"); } #[test] fn cubed() { let expr = " x 3 "; test("sv", "SimpleSpeak", expr, "x kubik"); } #[test] fn ordinal_power() { let expr = " x 4 "; test("sv", "SimpleSpeak", expr, "x upphöjt till 4,"); } #[test] fn simple_mi_power() { let expr = " x n "; test("sv", "SimpleSpeak", expr, "x upphöjt till n,"); } #[test] fn zero_power() { let expr = " x 0 "; test("sv", "SimpleSpeak", expr, "x upphöjt till 0,"); } #[test] fn decimal_power() { let expr = " x 2,0 "; test("sv", "SimpleSpeak", expr, "x upphöjt till 2,0,"); } #[test] fn non_simple_power() { let expr = " 3 y+2 "; test("sv", "SimpleSpeak", expr, "3 upphöjt till y plus 2"); } #[test] fn negative_power() { let expr = " x - 2 "; test("sv", "SimpleSpeak", expr, "x upphöjt till minus 2,"); } #[test] fn simple_fraction_power() { let expr = " x 13 "; test("sv", "SimpleSpeak", expr, "x upphöjt till en tredjedel"); } #[test] fn nested_squared_power_with_coef() { let expr = " 3 2 x 2 "; test("sv", "SimpleSpeak", expr, "3 upphöjt till 2 x kvadrat"); } #[test] fn nested_squared_power_with_neg_coef() { let expr = " 3 - 2 x 2 "; test("sv", "SimpleSpeak", expr, "3 upphöjt till minus 2 x kvadrat"); } #[test] fn nested_cubed_power() { let expr = " y 45 3 "; test("sv", "SimpleSpeak", expr, "y upphöjt till 4 femtedelar kubik"); } #[test] fn nested_cubed_power_with_neg_base() { let expr = " y - 45 3 "; test("sv", "SimpleSpeak", expr, "y upphöjt till minus 4 femtedelar kubik"); } #[test] fn nested_number_times_squared() { let expr = " e 1 2 x 2 "; test("sv", "SimpleSpeak", expr, "e upphöjt till en halv x kvadrat"); } #[test] fn nested_negative_number_times_squared() { let expr = " e 1 2 x 2 "; test("sv", "SimpleSpeak", expr, "e upphöjt till minus en halv x kvadrat"); } #[test] fn nested_expr_to_tenth() { let expr = " 3 3 10 "; test("sv", "SimpleSpeak", expr, "3 upphöjt till 3 upphöjt till 10,"); } #[test] fn nested_non_simple_squared_exp() { let expr = " 3 ( x+1 ) 2 "; test("sv", "SimpleSpeak", expr, "3 upphöjt till vänster-parentes; x plus 1; höger-parentes kvadrat"); } #[test] fn nested_simple_power() { let expr = " t 45 n "; test("sv", "SimpleSpeak", expr, "t upphöjt till 4 femtedelar upphöjt till n,"); } #[test] fn nested_end_exponent_power() { let expr = " t 45 n+1 "; test("sv", "SimpleSpeak", expr, "t upphöjt till 4 femtedelar upphöjt till n plus 1, slut exponent"); } #[test] fn nested_end_exponent_neg_power() { let expr = " t 45 -3 "; test("sv", "SimpleSpeak", expr, "t upphöjt till 4 femtedelar upphöjt till minus 3; slut exponent"); } #[test] fn nested_complex_power() { let expr = " e 1 2 ( xμ σ ) 2 "; test("sv", "SimpleSpeak", expr, "e upphöjt till minus en halv gånger; vänster-parentes; division, x minus my, genom sigma, slut division; höger-parentes kvadrat"); } #[test] fn default_power() { let expr = " t b+1 3 "; test("sv", "SimpleSpeak", expr, "t upphöjt till division, b plus 1, genom 3, slut division;"); }