/// 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("fi", "SimpleSpeak", expr, "1 kahdesosa"); } #[test] fn common_fraction_thirds() { let expr = " 2 3 "; test("fi", "SimpleSpeak", expr, "2 kolmasosaa"); } #[test] fn common_fraction_tenths() { let expr = " 17 10 "; test("fi", "SimpleSpeak", expr, "17 kymmenesosaa"); } #[test] #[allow(non_snake_case)] fn not_SimpleSpeak_common_fraction_tenths() { let expr = " 89 10 "; test("fi", "SimpleSpeak", expr, "89 per 10,"); } #[test] fn non_simple_fraction() { let expr = " x+y x-y "; test("fi", "SimpleSpeak", expr, "murtoluku, x plus y, per, x miinus y, loppu murtoluku;"); } #[test] fn nested_fraction() { let expr = " x+ 1y x-y "; test("fi", "SimpleSpeak", expr, "murtoluku, x plus, murtoluku, 1 per y, loppu murtoluku; per, x miinus y, loppu murtoluku;"); } #[test] fn deeply_nested_fraction_msqrt() { let expr = " x+ 1y x-y "; test("fi", "SimpleSpeak", expr, "murtoluku, x plus, neliöjuuri 1 per y, loppu juuri; per, x miinus y, loppu murtoluku;"); } #[test] fn deeply_nested_fraction_mrow_msqrt() { let expr = " x+ 2+1y x-y "; test("fi", "SimpleSpeak", expr, "murtoluku, x plus, neliöjuuri 2 plus 1 per y, loppu juuri; per, x miinus y, loppu murtoluku;"); } #[test] fn numerator_simple_fraction() { let expr = " x x-y "; test("fi", "SimpleSpeak", expr, "murtoluku, x per, x miinus y, loppu murtoluku;"); } #[test] fn denominator_simple_fraction() { let expr = " x-y x "; test("fi", "SimpleSpeak", expr, "murtoluku, x miinus y, per x, loppu murtoluku;"); } #[test] fn mixed_number() { let expr = " 3 1 2 "; test("fi", "SimpleSpeak", expr, "3 ja 1 kahdesosa"); } #[test] fn explicit_mixed_number() { let expr = " 3 1 8 "; test("fi", "SimpleSpeak", expr, "3 ja 1 kahdeksasosa"); } #[test] fn mixed_number_big() { let expr = " 3 7 83 "; test("fi", "SimpleSpeak", expr, "3 ja 7 kahdeksankymmentä kolmasosaa"); } #[test] fn simple_text() { let expr = " osoittaja nimittäjä "; test("fi", "SimpleSpeak", expr, "osoittaja per nimittäjä,"); } #[test] fn number_and_text() { let expr = " 2mailia 3gallonaa "; test("fi", "SimpleSpeak", expr, "murtoluku, 2 mailia, per, 3 gallonaa, loppu murtoluku;"); } #[test] fn nested_simple_fractions() { let expr = " 1 2 2 3 "; test("fi", "SimpleSpeak", expr, "murtoluku, 1 kahdesosa, per, 2 kolmasosaa, loppu murtoluku;"); } #[test] fn binomial() { let expr = " 2 ( 7 3 ) "; test("fi", "SimpleSpeak", expr, "2 kertaa 7 yli 3"); }