use crate::common::*; #[test] fn matrix_1x1() { let expr = " ( 3 ) "; test("fi", "ClearSpeak", expr, "1 kertaa 1 matriisi 3;"); test("fi", "SimpleSpeak", expr, "1 kertaa 1 matriisi 3;"); } #[test] fn determinant_1x1() { let expr = " | 3 | "; test("fi", "ClearSpeak", expr, "1 kertaa 1 determinantti 3;"); test("fi", "SimpleSpeak", expr, "1 kertaa 1 determinantti 3;"); } #[test] fn matrix_1x2() { let expr = " ( 3 5 ) "; test("fi", "ClearSpeak", expr, "1 kertaa 2 rivi matriisi; 3, 5;"); test("fi", "SimpleSpeak", expr, "1 kertaa 2 rivi matriisi; 3, 5;"); } #[test] fn matrix_1x3() { let expr = " ( -x 5 12 ) "; test("fi", "ClearSpeak", expr, "1 kertaa 3 rivi matriisi; negatiivinen x, 5, 12;"); test("fi", "SimpleSpeak", expr, "1 kertaa 3 rivi matriisi; negatiivinen x, 5, 12;"); } #[test] fn matrix_2x1_not_simple() { let expr = " ( x+1 x-1 ) "; test("fi", "ClearSpeak", expr, "2 kertaa 1 sarake matriisi; rivi 1; x plus 1; rivi 2; x miinus 1;"); test("fi", "SimpleSpeak", expr, "2 kertaa 1 sarake matriisi; rivi 1; x plus 1; rivi 2; x miinus 1;"); } #[test] fn matrix_3x1_not_simple() { let expr = " ( x a x x+1 ) "; test("fi", "SimpleSpeak", expr, "3 kertaa 1 sarake matriisi; rivi 1; x; rivi 2; a; rivi 3; murtoluku, x per, x plus 1, loppu murtoluku;"); test("fi", "ClearSpeak", expr, "3 kertaa 1 sarake matriisi; rivi 1; x; rivi 2; a; rivi 3; murtoluku osoittaja x; ja nimittäjä x plus 1;"); } #[test] fn determinant_2x2() { let expr = " | 2 1 7 5 | "; test("fi", "ClearSpeak", expr, "2 kertaa 2 determinantti; rivi 1; 2, 1; rivi 2; 7, 5;"); test("fi", "SimpleSpeak", expr, "2 kertaa 2 determinantti; rivi 1; 2, 1; rivi 2; 7, 5;"); } #[test] fn matrix_2x3() { let expr = " [ 3 1 4 0 2 6 ] "; test("fi", "ClearSpeak", expr, "2 kertaa 3 matriisi; rivi 1; 3, 1, 4; rivi 2; 0, 2, 6;"); test("fi", "SimpleSpeak", expr, "2 kertaa 3 matriisi; rivi 1; 3, 1, 4; rivi 2; 0, 2, 6;"); } #[test] fn matrix_2x3_labeled() { let expr = " [ (3.1) 3 1 4 0 2 6 ] "; test("fi", "ClearSpeak", expr, "2 kertaa 3 matriisi; rivi 1 merkinnällä (3.1); sarake 2; 3, sarake 3; 1, sarake 4; 4; rivi 2; sarake 1; 0, sarake 2; 2, sarake 3; 6;"); test("fi", "SimpleSpeak", expr, "2 kertaa 3 matriisi; rivi 1 merkinnällä (3.1); sarake 2; 3, sarake 3; 1, sarake 4; 4; rivi 2; sarake 1; 0, sarake 2; 2, sarake 3; 6;"); } #[test] fn matrix_3x1() { let expr = " [ 1 2 3 ] "; test("fi", "ClearSpeak", expr, "3 kertaa 1 sarake matriisi; 1; 2; 3;"); test("fi", "SimpleSpeak", expr, "3 kertaa 1 sarake matriisi; 1; 2; 3;"); } #[test] fn matrix_4x1() { let expr = " ( 3 6 1 2 ) "; test("fi", "ClearSpeak", expr, "4 kertaa 1 sarake matriisi; rivi 1; 3; rivi 2; 6; rivi 3; 1; rivi 4; 2;"); test("fi", "SimpleSpeak", expr, "4 kertaa 1 sarake matriisi; rivi 1; 3; rivi 2; 6; rivi 3; 1; rivi 4; 2;"); } #[test] fn matrix_4x1_labeled() { let expr = " ( 3 6 1 (3.1) 2 ) "; test("fi", "ClearSpeak", expr, "4 kertaa 1 sarake matriisi; rivi 1; 3; rivi 2; 6; rivi 3; 1; rivi 4 merkinnällä (3.1); 2;"); test("fi", "SimpleSpeak", expr, "4 kertaa 1 sarake matriisi; rivi 1; 3; rivi 2; 6; rivi 3; 1; rivi 4 merkinnällä (3.1); 2;"); } #[test] fn matrix_1x4() { let expr = " ( 3 6 1 2 ) "; test("fi", "ClearSpeak", expr, "1 kertaa 4 rivi matriisi; sarake 1; 3, sarake 2; 6, sarake 3; 1, sarake 4; 2;"); test("fi", "SimpleSpeak", expr, "1 kertaa 4 rivi matriisi; sarake 1; 3, sarake 2; 6, sarake 3; 1, sarake 4; 2;"); } #[test] fn matrix_4x4() { let expr = " ( 0 3 4 3 2 1 0 9 3 0 2 1 6 2 9 0 ) "; test("fi", "ClearSpeak", expr, "4 kertaa 4 matriisi; rivi 1; sarake 1; 0, sarake 2; 3, sarake 3; 4, sarake 4; 3; rivi 2; sarake 1; 2, sarake 2; 1, sarake 3; 0, sarake 4; 9; rivi 3; sarake 1; 3, sarake 2; 0, sarake 3; 2, sarake 4; 1; rivi 4; sarake 1; 6, sarake 2; 2, sarake 3; 9, sarake 4; 0;"); test("fi", "SimpleSpeak", expr, "4 kertaa 4 matriisi; rivi 1; sarake 1; 0, sarake 2; 3, sarake 3; 4, sarake 4; 3; rivi 2; sarake 1; 2, sarake 2; 1, sarake 3; 0, sarake 4; 9; rivi 3; sarake 1; 3, sarake 2; 0, sarake 3; 2, sarake 4; 1; rivi 4; sarake 1; 6, sarake 2; 2, sarake 3; 9, sarake 4; 0;");} #[test] fn matrix_4x2() { let expr = " ( 1 3 4 2 2 1 0 5 ) "; test("fi", "ClearSpeak", expr, "4 kertaa 2 matriisi; rivi 1; sarake 1; 1, sarake 2; 3; rivi 2; sarake 1; 4, sarake 2; 2; rivi 3; sarake 1; 2, sarake 2; 1; rivi 4; sarake 1; 0, sarake 2; 5;"); test("fi", "SimpleSpeak", expr, "4 kertaa 2 matriisi; rivi 1; sarake 1; 1, sarake 2; 3; rivi 2; sarake 1; 4, sarake 2; 2; rivi 3; sarake 1; 2, sarake 2; 1; rivi 4; sarake 1; 0, sarake 2; 5;");} // put absolute value test here since it is related to determinate and is small for its own file #[test] fn simple_absolute_value() { let expr = " | x | "; test("fi", "SimpleSpeak", expr, "itseisarvo x,"); test("fi", "ClearSpeak", expr, "itseisarvo x,"); test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Terse"), ("ClearSpeak_AbsoluteValue", "Auto")], expr, "itseisarvo x,"); test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Verbose"), ("ClearSpeak_AbsoluteValue", "AbsEnd")], expr, "itseisarvo x, loppu itseisarvo,"); } #[test] fn absolute_value_plus_1() { let expr = " | x+1 | "; test("fi", "ClearSpeak", expr, "itseisarvo x plus 1,"); test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Terse"), ("ClearSpeak_AbsoluteValue", "AbsEnd")], expr, "itseisarvo x plus 1, loppu itseisarvo,"); } #[test] fn simple_cardinality_value() { let expr = " | S | "; test_prefs("fi", "ClearSpeak", vec![("Verbosity", "Medium"), ("ClearSpeak_AbsoluteValue", "Cardinality")], expr, "kardinaliteetti iso s,"); } // Test preferences #[test] fn simple_matrix_speak_col_num() { let expr = " ( 2 1 7 5 ) "; test_ClearSpeak("fi", "ClearSpeak_Matrix", "SpeakColNum", expr, "2 kertaa 2 matriisi; rivi 1; sarake 1; 2, sarake 2; 1; rivi 2; sarake 1; 7, sarake 2; 5;"); } #[test] fn col_matrix_3x1_speak_col_num() { let expr = " ( 1 2 3 ) "; test_ClearSpeak("fi", "ClearSpeak_Matrix", "SpeakColNum", expr, "3 kertaa 1 sarake matriisi; rivi 1; 1; rivi 2; 2; rivi 3; 3;"); } #[test] fn row_matrix_1x2_speak_col_num() { let expr = " [ 1 2 ] "; test_ClearSpeak("fi", "ClearSpeak_Matrix", "SpeakColNum", expr, "1 kertaa 2 rivi matriisi; sarake 1; 1, sarake 2; 2;"); } #[test] fn matrix_2x2_speak_col_num() { let expr = "( b11 b12 b21 b22 )"; test_ClearSpeak("fi", "ClearSpeak_Matrix", "SpeakColNum", expr, "2 kertaa 2 matriisi; rivi 1; sarake 1; b ala 1 1, sarake 2; b ala 1 2; rivi 2; sarake 1; b ala 2 1, sarake 2; b ala 2 2;"); } #[test] fn simple_matrix_silent_col_num() { let expr = " ( 2 1 7 5 ) "; test_ClearSpeak("fi", "ClearSpeak_Matrix", "SilentColNum", expr, "2 kertaa 2 matriisi; rivi 1; 2, 1; rivi 2; 7, 5;"); } #[test] fn col_matrix_3x1_silent_col_num() { let expr = " ( 1 2 3 ) "; test_ClearSpeak("fi", "ClearSpeak_Matrix", "SilentColNum", expr, "3 kertaa 1 sarake matriisi; 1; 2; 3;"); } #[test] fn row_matrix_1x2_silent_col_num() { let expr = " [ 1 2 ] "; test_ClearSpeak("fi", "ClearSpeak_Matrix", "SilentColNum", expr, "1 kertaa 2 rivi matriisi; 1, 2;"); } #[test] fn matrix_2x2_silent_col_num() { let expr = "( b11 b12 b21 b22 )"; test_ClearSpeak("fi", "ClearSpeak_Matrix", "SilentColNum", expr, "2 kertaa 2 matriisi; rivi 1; b ala 1 1, b ala 1 2; rivi 2; b ala 2 1, b ala 2 2;"); } #[test] fn simple_matrix_end_matrix() { let expr = " ( 2 1 7 5 ) "; test_ClearSpeak("fi", "ClearSpeak_Matrix", "EndMatrix", expr, "2 kertaa 2 matriisi; rivi 1; 2, 1; rivi 2; 7, 5; loppu matriisi"); } #[test] fn col_matrix_3x1_end_matrix() { let expr = " ( 1 2 3 ) "; test_ClearSpeak("fi", "ClearSpeak_Matrix", "EndMatrix", expr, "3 kertaa 1 sarake matriisi; 1; 2; 3; loppu matriisi"); } #[test] fn row_matrix_1x2_end_matrix() { let expr = " [ 1 2 ] "; test_ClearSpeak("fi", "ClearSpeak_Matrix", "EndMatrix", expr, "1 kertaa 2 rivi matriisi; 1, 2; loppu matriisi"); } #[test] fn matrix_2x2_end_matrix() { let expr = "( b11 b12 b21 b22 )"; test_ClearSpeak("fi", "ClearSpeak_Matrix", "EndMatrix", expr, "2 kertaa 2 matriisi; rivi 1; sarake 1; b ala 1 1, sarake 2; b ala 1 2; rivi 2; sarake 1; b ala 2 1, sarake 2; b ala 2 2; loppu matriisi"); } #[test] fn simple_matrix_vector() { let expr = " ( 2 1 7 5 ) "; test_ClearSpeak("fi", "ClearSpeak_Matrix", "Vector", expr, "2 kertaa 2 matriisi; rivi 1; 2, 1; rivi 2; 7, 5;"); } #[test] fn col_matrix_3x1_vector() { let expr = " ( 1 2 3 ) "; test_ClearSpeak("fi", "ClearSpeak_Matrix", "Vector", expr, "3 kertaa 1 sarake vektori; 1; 2; 3;"); } #[test] fn row_matrix_1x2_vector() { let expr = " [ 1 2 ] "; test_ClearSpeak("fi", "ClearSpeak_Matrix", "Vector", expr, "1 kertaa 2 rivi vektori; 1, 2;"); } #[test] fn matrix_2x2_vector() { let expr = "( b11 b12 b21 b22 )"; test_ClearSpeak("fi", "ClearSpeak_Matrix", "Vector", expr, "2 kertaa 2 matriisi; rivi 1; sarake 1; b ala 1 1, sarake 2; b ala 1 2; rivi 2; sarake 1; b ala 2 1, sarake 2; b ala 2 2;"); } #[test] fn simple_matrix_end_vector() { let expr = " ( 2 1 7 5 ) "; test_ClearSpeak("fi", "ClearSpeak_Matrix", "EndVector", expr, "2 kertaa 2 matriisi; rivi 1; 2, 1; rivi 2; 7, 5; loppu matriisi"); } #[test] fn col_matrix_3x1_end_vector() { let expr = " ( 1 2 3 ) "; test_ClearSpeak("fi", "ClearSpeak_Matrix", "EndVector", expr, "3 kertaa 1 sarake vektori; 1; 2; 3; loppu vektori"); } #[test] fn row_matrix_1x2_end_vector() { let expr = " [ 1 2 ] "; test_ClearSpeak("fi", "ClearSpeak_Matrix", "EndVector", expr, "1 kertaa 2 rivi vektori; 1, 2; loppu vektori"); } #[test] fn matrix_2x2_end_vector() { let expr = "( b11 b12 b21 b22 )"; test_ClearSpeak("fi", "ClearSpeak_Matrix", "EndVector", expr, "2 kertaa 2 matriisi; rivi 1; sarake 1; b ala 1 1, sarake 2; b ala 1 2; rivi 2; sarake 1; b ala 2 1, sarake 2; b ala 2 2; loppu matriisi"); } #[test] fn matrix_binomial() { let expr = " ( 32 ) "; test_ClearSpeak("fi", "ClearSpeak_Matrix", "Combinatorics", expr, "3 yli 2"); }