/// Tests for fractions /// includes simple fractions and more complex fractions /// also tests mixed fractions (implicit and explicit) use crate::common::*; #[test] fn common_fraction_half() { let expr = " 1 2 "; test("sv", "SimpleSpeak", expr, "en halv"); } #[test] fn common_fraction_thirds() { let expr = " 2 3 "; test("sv", "SimpleSpeak", expr, "2 tredjedelar"); } #[test] fn common_fraction_tenths() { let expr = " 17 10 "; test("sv", "SimpleSpeak", expr, "17 tiondelar"); } #[test] #[allow(non_snake_case)] fn not_SimpleSpeak_common_fraction_tenths() { let expr = " 89 10 "; test("sv", "SimpleSpeak", expr, "89 genom 10,"); } #[test] fn non_simple_fraction() { let expr = " x+y x-y "; test("sv", "SimpleSpeak", expr, "division, x plus y, genom, x minus y, slut division;"); } #[test] fn nested_fraction() { let expr = " x+ 1y x-y "; test("sv", "SimpleSpeak", expr, "division, x plus, division, 1 genom y, slut division; genom, x minus y, slut division;"); } #[test] fn deeply_nested_fraction_msqrt() { let expr = " x+ 1y x-y "; test("sv", "SimpleSpeak", expr, "division, x plus, kvadratroten ur 1 genom y, slut rot; genom, x minus y, slut division;"); } #[test] fn deeply_nested_fraction_mrow_msqrt() { let expr = " x+ 2+1y x-y "; test("sv", "SimpleSpeak", expr, "division, x plus, kvadratroten ur 2 plus 1 genom y, slut rot; genom, x minus y, slut division;"); } #[test] fn numerator_simple_fraction() { let expr = " x x-y "; test("sv", "SimpleSpeak", expr, "division, x genom, x minus y, slut division;"); } #[test] fn denominator_simple_fraction() { let expr = " x-y x "; test("sv", "SimpleSpeak", expr, "division, x minus y, genom x, slut division;"); } #[test] fn mixed_number() { let expr = " 3 1 2 "; test("sv", "SimpleSpeak", expr, "3 och en halv"); } #[test] fn explicit_mixed_number() { let expr = " 3 1 8 "; test("sv", "SimpleSpeak", expr, "3 och en åttondel"); } #[test] fn mixed_number_big() { let expr = " 3 7 83 "; test("sv", "SimpleSpeak", expr, "3 och 7 genom 83,"); } #[test] fn simple_text() { let expr = " rise run "; test("sv", "SimpleSpeak", expr, "rise genom run,"); } #[test] fn number_and_text() { let expr = " 2miles 3gallons "; test("sv", "SimpleSpeak", expr, "division, 2 miles, genom, 3 gallons, slut division;"); } #[test] fn nested_simple_fractions() { let expr = " 1 2 2 3 "; test("sv", "SimpleSpeak", expr, "division, en halv, genom, 2 tredjedelar, slut division;"); } #[test] fn binomial() { let expr = " 2 ( 7 3 ) "; test("sv", "SimpleSpeak", expr, "2 gånger, 7 över 3"); }