use crate::common::*; #[test] fn matrix_1x1() { let expr = " ( 3 ) "; test("sv", "ClearSpeak", expr, "ett-gånger-ett matris med element 3;"); test("sv", "SimpleSpeak", expr, "ett-gånger-ett matris med element 3;"); } #[test] fn determinant_1x1() { let expr = " | 3 | "; test("sv", "ClearSpeak", expr, "ett-gånger-ett determinant med element 3;"); test("sv", "SimpleSpeak", expr, "ett-gånger-ett determinant med element 3;"); } #[test] fn matrix_1x2() { let expr = " ( 3 5 ) "; test("sv", "ClearSpeak", expr, "ett-gånger 2 rad-matris; 3, 5;"); test("sv", "SimpleSpeak", expr, "ett-gånger 2 rad-matris; 3, 5;"); } #[test] fn matrix_1x3() { let expr = " ( -x 5 12 ) "; test("sv", "ClearSpeak", expr, "ett-gånger 3 rad-matris; minus x, 5, 12;"); test("sv", "SimpleSpeak", expr, "ett-gånger 3 rad-matris; minus x, 5, 12;"); } #[test] fn matrix_2x1_not_simple() { let expr = " ( x+1 x-1 ) "; test("sv", "ClearSpeak", expr, "2 gånger-ett kolumn-matris; rad 1; x plus 1; rad 2; x minus 1;"); test("sv", "SimpleSpeak", expr, "2 gånger-ett kolumn-matris; rad 1; x plus 1; rad 2; x minus 1;"); } #[test] fn matrix_3x1_not_simple() { let expr = " ( x a x x+1 ) "; test("sv", "SimpleSpeak", expr, "3 gånger-ett kolumn-matris; \ rad 1; x; \ rad 2; a; \ rad 3; division, x genom, x plus 1, slut division;"); test("sv", "ClearSpeak", expr, "3 gånger-ett kolumn-matris; \ rad 1; x; \ rad 2; a; \ rad 3; division med täljaren x; och nämnaren x plus 1;"); } #[test] fn determinant_2x2() { let expr = " | 2 1 7 5 | "; test("sv", "ClearSpeak", expr, "2 gånger 2 determinant; rad 1; 2, 1; rad 2; 7, 5;"); test("sv", "SimpleSpeak", expr, "2 gånger 2 determinant; rad 1; 2, 1; rad 2; 7, 5;"); } #[test] fn matrix_2x3() { let expr = " [ 3 1 4 0 2 6 ] "; test("sv", "ClearSpeak", expr, "2 gånger 3 matris; rad 1; 3, 1, 4; rad 2; 0, 2, 6;"); test("sv", "SimpleSpeak", expr, "2 gånger 3 matris; rad 1; 3, 1, 4; rad 2; 0, 2, 6;"); } #[test] fn matrix_2x3_labeled() { let expr = " [ (3.1) 3 1 4 0 2 6 ] "; test("sv", "ClearSpeak", expr, "2 gånger 3 matris; rad 1 med etiketten (3 punkt 1); kolumn 2; 3, kolumn 3; 1, kolumn 4; 4; rad 2; kolumn 1; 0, kolumn 2; 2, kolumn 3; 6;"); test("sv", "SimpleSpeak", expr, "2 gånger 3 matris; rad 1 med etiketten (3 punkt 1); kolumn 2; 3, kolumn 3; 1, kolumn 4; 4; rad 2; kolumn 1; 0, kolumn 2; 2, kolumn 3; 6;"); } #[test] fn matrix_3x1() { let expr = " [ 1 2 3 ] "; test("sv", "ClearSpeak", expr, "3 gånger-ett kolumn-matris; 1; 2; 3;"); test("sv", "SimpleSpeak", expr, "3 gånger-ett kolumn-matris; 1; 2; 3;"); } #[test] fn matrix_4x1() { let expr = " ( 3 6 1 2 ) "; test("sv", "ClearSpeak", expr, "4 gånger-ett kolumn-matris; rad 1; 3; rad 2; 6; rad 3; 1; rad 4; 2;"); test("sv", "SimpleSpeak", expr, "4 gånger-ett kolumn-matris; rad 1; 3; rad 2; 6; rad 3; 1; rad 4; 2;"); } #[test] fn matrix_4x1_labeled() { let expr = " ( 3 6 1 (3.1) 2 ) "; test("sv", "ClearSpeak", expr, "4 gånger-ett kolumn-matris; rad 1; 3; rad 2; 6; rad 3; 1; rad 4 med etiketten (3 punkt 1); 2;"); test("sv", "SimpleSpeak", expr, "4 gånger-ett kolumn-matris; rad 1; 3; rad 2; 6; rad 3; 1; rad 4 med etiketten (3 punkt 1); 2;"); } #[test] fn matrix_1x4() { let expr = " ( 3 6 1 2 ) "; test("sv", "ClearSpeak", expr, "ett-gånger 4 rad-matris; kolumn 1; 3, kolumn 2; 6, kolumn 3; 1, kolumn 4; 2;"); test("sv", "SimpleSpeak", expr, "ett-gånger 4 rad-matris; kolumn 1; 3, kolumn 2; 6, kolumn 3; 1, kolumn 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("sv", "ClearSpeak", expr, "4 gånger 4 matris; \ rad 1; kolumn 1; 0, kolumn 2; 3, kolumn 3; 4, kolumn 4; 3; \ rad 2; kolumn 1; 2, kolumn 2; 1, kolumn 3; 0, kolumn 4; 9; \ rad 3; kolumn 1; 3, kolumn 2; 0, kolumn 3; 2, kolumn 4; 1; \ rad 4; kolumn 1; 6, kolumn 2; 2, kolumn 3; 9, kolumn 4; 0;"); test("sv", "SimpleSpeak", expr, "4 gånger 4 matris; \ rad 1; kolumn 1; 0, kolumn 2; 3, kolumn 3; 4, kolumn 4; 3; \ rad 2; kolumn 1; 2, kolumn 2; 1, kolumn 3; 0, kolumn 4; 9; \ rad 3; kolumn 1; 3, kolumn 2; 0, kolumn 3; 2, kolumn 4; 1; \ rad 4; kolumn 1; 6, kolumn 2; 2, kolumn 3; 9, kolumn 4; 0;");} #[test] fn matrix_4x2() { let expr = " ( 1 3 4 2 2 1 0 5 ) "; test("sv", "ClearSpeak", expr, "4 gånger 2 matris; \ rad 1; kolumn 1; 1, kolumn 2; 3; \ rad 2; kolumn 1; 4, kolumn 2; 2; \ rad 3; kolumn 1; 2, kolumn 2; 1; \ rad 4; kolumn 1; 0, kolumn 2; 5;"); test("sv", "SimpleSpeak", expr, "4 gånger 2 matris; \ rad 1; kolumn 1; 1, kolumn 2; 3; \ rad 2; kolumn 1; 4, kolumn 2; 2; \ rad 3; kolumn 1; 2, kolumn 2; 1; \ rad 4; kolumn 1; 0, kolumn 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("sv", "SimpleSpeak", expr, "absolutbeloppet av x,"); test("sv", "ClearSpeak", expr, "absolutbeloppet av x,"); test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Terse"), ("ClearSpeak_AbsoluteValue", "Auto")], expr, "absolutbeloppet av x,"); test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Verbose"), ("ClearSpeak_AbsoluteValue", "AbsEnd")], expr, "absolutbeloppet av x, slut absolutbelopp,"); } #[test] fn absolute_value_plus_1() { let expr = " | x+1 | "; test("sv", "ClearSpeak", expr, "absolutbeloppet av x plus 1,"); test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Terse"), ("ClearSpeak_AbsoluteValue", "AbsEnd")], expr, "absolutbeloppet av x plus 1, slut absolutbelopp,"); } #[test] fn simple_cardinality_value() { let expr = " | S | "; test_prefs("sv", "ClearSpeak", vec![("Verbosity", "Medium"), ("ClearSpeak_AbsoluteValue", "Cardinality")], expr, "kardinaliteten av versal s,"); } // Test preferences #[test] fn simple_matrix_speak_col_num() { let expr = " ( 2 1 7 5 ) "; test_ClearSpeak("sv", "ClearSpeak_Matrix", "SpeakColNum", expr, "2 gånger 2 matris; rad 1; kolumn 1; 2, kolumn 2; 1; rad 2; kolumn 1; 7, kolumn 2; 5;"); } #[test] fn col_matrix_3x1_speak_col_num() { let expr = " ( 1 2 3 ) "; test_ClearSpeak("sv", "ClearSpeak_Matrix", "SpeakColNum", expr, "3 gånger-ett kolumn-matris; rad 1; 1; rad 2; 2; rad 3; 3;"); } #[test] fn row_matrix_1x2_speak_col_num() { let expr = " [ 1 2 ] "; test_ClearSpeak("sv", "ClearSpeak_Matrix", "SpeakColNum", expr, "ett-gånger 2 rad-matris; kolumn 1; 1, kolumn 2; 2;"); } #[test] fn matrix_2x2_speak_col_num() { let expr = "( b11 b12 b21 b22 )"; test_ClearSpeak("sv", "ClearSpeak_Matrix", "SpeakColNum", expr, "2 gånger 2 matris; rad 1; kolumn 1; b nedsänkt 1 1, kolumn 2; b nedsänkt 1 2; \ rad 2; kolumn 1; b nedsänkt 2 1, kolumn 2; b nedsänkt 2 2;"); } #[test] fn simple_matrix_silent_col_num() { let expr = " ( 2 1 7 5 ) "; test_ClearSpeak("sv", "ClearSpeak_Matrix", "SilentColNum", expr, "2 gånger 2 matris; rad 1; 2, 1; rad 2; 7, 5;"); } #[test] fn col_matrix_3x1_silent_col_num() { let expr = " ( 1 2 3 ) "; test_ClearSpeak("sv", "ClearSpeak_Matrix", "SilentColNum", expr, "3 gånger-ett kolumn-matris; 1; 2; 3;"); } #[test] fn row_matrix_1x2_silent_col_num() { let expr = " [ 1 2 ] "; test_ClearSpeak("sv", "ClearSpeak_Matrix", "SilentColNum", expr, "ett-gånger 2 rad-matris; 1, 2;"); } #[test] fn matrix_2x2_silent_col_num() { let expr = "( b11 b12 b21 b22 )"; test_ClearSpeak("sv", "ClearSpeak_Matrix", "SilentColNum", expr, "2 gånger 2 matris; rad 1; b nedsänkt 1 1, b nedsänkt 1 2; \ rad 2; b nedsänkt 2 1, b nedsänkt 2 2;"); } #[test] fn simple_matrix_end_matrix() { let expr = " ( 2 1 7 5 ) "; test_ClearSpeak("sv", "ClearSpeak_Matrix", "EndMatrix", expr, "2 gånger 2 matris; rad 1; 2, 1; rad 2; 7, 5; slut matris"); } #[test] fn col_matrix_3x1_end_matrix() { let expr = " ( 1 2 3 ) "; test_ClearSpeak("sv", "ClearSpeak_Matrix", "EndMatrix", expr, "3 gånger-ett kolumn-matris; 1; 2; 3; slut matris"); } #[test] fn row_matrix_1x2_end_matrix() { let expr = " [ 1 2 ] "; test_ClearSpeak("sv", "ClearSpeak_Matrix", "EndMatrix", expr, "ett-gånger 2 rad-matris; 1, 2; slut matris"); } #[test] fn matrix_2x2_end_matrix() { let expr = "( b11 b12 b21 b22 )"; test_ClearSpeak("sv", "ClearSpeak_Matrix", "EndMatrix", expr, "2 gånger 2 matris; rad 1; kolumn 1; b nedsänkt 1 1, kolumn 2; b nedsänkt 1 2; \ rad 2; kolumn 1; b nedsänkt 2 1, kolumn 2; b nedsänkt 2 2; slut matris"); } #[test] fn simple_matrix_vector() { let expr = " ( 2 1 7 5 ) "; test_ClearSpeak("sv", "ClearSpeak_Matrix", "Vector", expr, "2 gånger 2 matris; rad 1; 2, 1; rad 2; 7, 5;"); } #[test] fn col_matrix_3x1_vector() { let expr = " ( 1 2 3 ) "; test_ClearSpeak("sv", "ClearSpeak_Matrix", "Vector", expr, "3 gånger-ett kolumn-vektor; 1; 2; 3;"); } #[test] fn row_matrix_1x2_vector() { let expr = " [ 1 2 ] "; test_ClearSpeak("sv", "ClearSpeak_Matrix", "Vector", expr, "ett-gånger 2 rad-vektor; 1, 2;"); } #[test] fn matrix_2x2_vector() { let expr = "( b11 b12 b21 b22 )"; test_ClearSpeak("sv", "ClearSpeak_Matrix", "Vector", expr, "2 gånger 2 matris; rad 1; kolumn 1; b nedsänkt 1 1, kolumn 2; b nedsänkt 1 2; \ rad 2; kolumn 1; b nedsänkt 2 1, kolumn 2; b nedsänkt 2 2;"); } #[test] fn simple_matrix_end_vector() { let expr = " ( 2 1 7 5 ) "; test_ClearSpeak("sv", "ClearSpeak_Matrix", "EndVector", expr, "2 gånger 2 matris; rad 1; 2, 1; rad 2; 7, 5; slut matris"); } #[test] fn col_matrix_3x1_end_vector() { let expr = " ( 1 2 3 ) "; test_ClearSpeak("sv", "ClearSpeak_Matrix", "EndVector", expr, "3 gånger-ett kolumn-vektor; 1; 2; 3; slut vektor"); } #[test] fn row_matrix_1x2_end_vector() { let expr = " [ 1 2 ] "; test_ClearSpeak("sv", "ClearSpeak_Matrix", "EndVector", expr, "ett-gånger 2 rad-vektor; 1, 2; slut vektor"); } #[test] fn matrix_2x2_end_vector() { let expr = "( b11 b12 b21 b22 )"; test_ClearSpeak("sv", "ClearSpeak_Matrix", "EndVector", expr, "2 gånger 2 matris; rad 1; kolumn 1; b nedsänkt 1 1, kolumn 2; b nedsänkt 1 2; \ rad 2; kolumn 1; b nedsänkt 2 1, kolumn 2; b nedsänkt 2 2; slut matris"); } #[test] fn matrix_binomial() { let expr = " ( 32 ) "; test_ClearSpeak("sv", "ClearSpeak_Matrix", "Combinatorics", expr, "3 över 2"); }