/// Tests for superscripts /// simple superscripts /// complex/nested superscripts use crate::common::*; #[test] fn squared() { let expr = " x 2 "; test("en", "SimpleSpeak", expr, "x squared"); } #[test] fn cubed() { let expr = " x 3 "; test("en", "SimpleSpeak", expr, "x cubed"); } #[test] fn ordinal_power() { let expr = " x 4 "; test("en", "SimpleSpeak", expr, "x to the fourth"); } #[test] fn simple_mi_power() { let expr = " x n "; test("en", "SimpleSpeak", expr, "x to the n-th"); } #[test] fn zero_power() { let expr = " x 0 "; test("en", "SimpleSpeak", expr, "x to the 0"); } #[test] fn decimal_power() { let expr = " x 2.0 "; test("en", "SimpleSpeak", expr, "x to the 2.0"); } #[test] fn non_simple_power() { let expr = " 3 y+2 "; test("en", "SimpleSpeak", expr, "3 raised to the y plus 2 power,"); } #[test] fn negative_power() { let expr = " x - 2 "; test("en", "SimpleSpeak", expr, "x to the negative 2"); } #[test] fn simple_fraction_power() { let expr = " x 13 "; test("en", "SimpleSpeak", expr, "x raised to the 1 third power,"); } #[test] fn nested_squared_power_with_coef() { let expr = " 3 2 x 2 "; test("en", "SimpleSpeak", expr, "3 raised to the 2 x squared power,"); } #[test] fn nested_squared_power_with_neg_coef() { let expr = " 3 - 2 x 2 "; test("en", "SimpleSpeak", expr, "3 raised to the negative 2 x squared power,"); } #[test] fn nested_cubed_power() { let expr = " y 45 3 "; test("en", "SimpleSpeak", expr, "y raised to the 4 fifths cubed power,"); } #[test] fn nested_cubed_power_with_neg_base() { let expr = " y - 45 3 "; test("en", "SimpleSpeak", expr, "y raised to the negative 4 fifths cubed power,"); } #[test] fn nested_number_times_squared() { let expr = " e 1 2 x 2 "; test("en", "SimpleSpeak", expr, "e raised to the 1 half x squared power,"); } #[test] fn nested_negative_number_times_squared() { let expr = " e 1 2 x 2 "; test("en", "SimpleSpeak", expr, "e raised to the negative 1 half x squared power,"); } #[test] fn nested_expr_to_tenth() { let expr = " 3 3 10 "; test("en", "SimpleSpeak", expr, "3 raised to the 3 to the tenth power,"); } #[test] fn nested_non_simple_squared_exp() { let expr = " 3 ( x+1 ) 2 "; test("en", "SimpleSpeak", expr, "3 raised to the open paren x plus 1, close paren squared power,"); } #[test] fn nested_simple_power() { let expr = " t 45 n "; test("en", "SimpleSpeak", expr, "t raised to the 4 fifths to the n-th power,"); } #[test] fn nested_end_exponent_power() { let expr = " t 45 n+1 "; test("en", "SimpleSpeak", expr, "t raised to the 4 fifths raised to the n plus 1 power; end exponent,"); test_prefs("en", "SimpleSpeak", vec![("Impairment", "LearningDisability")], expr, "t raised to the 4 fifths raised to the n plus 1 power;"); } #[test] fn nested_end_exponent_neg_power() { let expr = " t 45 -3 "; test("en", "SimpleSpeak", expr, "t raised to the 4 fifths to the negative 3, end exponent,"); } #[test] fn nested_complex_power() { let expr = " e 1 2 ( xμ σ ) 2 "; test("en", "SimpleSpeak", expr, "e raised to the negative 1 half times; open paren, fraction, x minus mu, over sigma, end fraction; close paren squared power,"); } #[test] fn default_power() { let expr = " t b+1 3 "; test("en", "SimpleSpeak", expr, "t raised to the fraction, b plus 1, over 3, end fraction; power,"); }