// Tests from https://www.once.es/servicios-sociales/braille/comision-braille-espanola/documentos-tecnicos/documentos-tecnicos-relacionados-con-el-braille/documentos/b5-signografia-matematica.pdf // This seems to be official guide. use crate::common::*; #[test] fn letter_number_1_0_1() { let expr = "234a5"; test_braille("CMU", expr, "⠼⠃⠉⠙⠐⠁⠑"); } #[test] fn letter_number_1_0_2() { let expr = "234ae"; test_braille("CMU", expr, "⠼⠃⠉⠙⠐⠁⠐⠑"); } #[test] fn greek_1_2_1() { let expr = "π"; test_braille("CMU", expr, "⠈⠏"); } #[test] fn greek_upper_1_2_2() { let expr = "Σ"; test_braille("CMU", expr, "⠘⠎"); } #[test] fn greek_var_1_2_3() { let expr = "ϵ"; test_braille("CMU", expr, "⠈⠬⠑"); } #[test] fn gothic_1_3_1() { let expr = "𝔞𝔉"; test_braille("CMU", expr, "⠠⠁⠰⠋"); } #[test] #[ignore] // need to add a transcriber note pref for different fonts fn double_struck_1_3_2() { let expr = "𝕔𝕎"; test_braille("CMU", expr, "⠬⠉⠩⠺"); } #[test] fn number_3_1_1() { let expr = "1.720"; test_braille("CMU", expr, "⠼⠁⠄⠛⠃⠚"); } #[test] fn number_2_2_1() { let expr = "31.720"; test_braille_prefs("CMU", vec![("DecimalSeparators", "."), ("BlockSeparators", ", ")], expr, "⠼⠉⠁⠄⠛⠃⠚"); } #[test] fn number_2_2_2() { let expr = "3 802 197"; test_braille_prefs("CMU", vec![("DecimalSeparators", "."), ("BlockSeparators", ", ")], expr, "⠼⠉⠄⠓⠚⠃⠄⠁⠊⠛"); } #[test] fn number_2_2_3() { let expr = "46781"; test_braille("CMU", expr, "⠼⠙⠋⠛⠓⠁"); } #[test] fn number_2_2_4() { let expr = "-7"; test_braille("CMU", expr, "⠤⠼⠛"); } #[test] fn number_2_2_5() { let expr = "-29"; test_braille("CMU", expr, "⠤⠼⠃⠊"); } #[test] fn number_2_2_6() { let expr = "-25 347"; test_braille_prefs("CMU", vec![("DecimalSeparators", "."), ("BlockSeparators", ", ")], expr, "⠤⠼⠃⠑⠄⠉⠙⠛"); } #[test] fn number_2_3_1() { let expr = "3.2"; test_braille_prefs("CMU", vec![("DecimalSeparators", "."), ("BlockSeparators", ", ")], expr, "⠼⠉⠂⠃"); } #[test] fn number_2_3_2() { let expr = "3,2"; test_braille_prefs("CMU", vec![("DecimalSeparators", ","), ("BlockSeparators", ". ")], expr, "⠼⠉⠂⠃"); } #[test] fn number_2_3_3() { let expr = "3’2"; test_braille_prefs("CMU", vec![("DecimalSeparators", "’,"), ("BlockSeparators", ". ")], expr, "⠼⠉⠂⠃"); } #[test] #[ignore] fn number_2_3_3_wiris() { let expr = "32"; test_braille("CMU", expr, "⠼⠉⠂⠃"); } #[test] fn number_2_3_4() { let expr = "3,254^"; test_braille("CMU", expr, "⠼⠉⠂⠃⠂⠑⠙"); } #[test] fn number_2_3_5() { let expr = "7,29^"; test_braille("CMU", expr, "⠼⠛⠂⠂⠃⠊"); } #[test] fn number_2_3_7() { let expr = "3,1415..."; test_braille("CMU", expr, "⠼⠉⠂⠁⠙⠁⠑⠄⠄⠄"); } #[test] fn numeric_fraction_2_4_1() { let expr = "34"; test_braille("CMU", expr, "⠼⠉⠲⠀"); } #[test] fn numeric_fraction_2_4_2() { let expr = "3863"; test_braille("CMU", expr, "⠼⠉⠓⠖⠒⠀"); } #[test] fn numeric_fraction_2_4_3() { let expr = "315"; test_braille("CMU", expr, "⠼⠉⠼⠁⠢⠀"); } #[test] fn letter_number_2_5_b_1() { let expr = "1B4D"; test_braille("CMU", expr, "⠼⠁⠨⠃⠙⠨⠙"); } #[test] #[ignore] // really requires a transcriber's note fn color_2_5_c_2() { let expr = "3429"; test_braille("CMU", expr, "⠼⠉⠩⠙⠃⠰⠊"); } #[test] fn number_base_2_5_d_1() { let expr = "1012"; test_braille("CMU", expr, "⠼⠁⠚⠁⠌⠼⠃"); } #[test] fn number_set_2_6() { // Double Struck N, Z, Q, R, C , I, P, D // this combines all the examples in the 3.5 into a set, so not exactly the example in the guide let expr = "{ ,,, ,,, , }"; test_braille("CMU", expr, "⠐⠇⠸⠝⠀⠂⠸⠵⠀⠂⠸⠟⠀⠂⠸⠗⠀⠂⠸⠉⠀⠂⠸⠓⠀⠂⠸⠕⠀⠂⠸⠏⠸⠂"); } #[test] fn script_4_2_1_1() { let expr = "zr"; test_braille("CMU", expr, "⠵⠠⠌⠗"); } #[test] fn script_4_2_1_2() { let expr = "zr"; test_braille("CMU", expr, "⠵⠈⠡⠗"); } #[test] fn script_4_2_1_3() { let expr = "zr"; test_braille("CMU", expr, "⠵⠌⠌⠗"); } #[test] fn script_4_2_1_4() { let expr = "zr"; test_braille("CMU", expr, "⠵⠡⠡⠗"); } #[test] fn script_4_2_1_5() { let expr = "zr"; test_braille("CMU", expr, "⠵⠌⠗"); } #[test] fn script_4_2_1_6() { let expr = "zr"; test_braille("CMU", expr, "⠵⠡⠗"); } #[test] fn script_4_2_1_7() { // z_{n-1} let expr = "zn-1"; test_braille("CMU", expr, "⠵⠌⠢⠝⠤⠼⠁⠔"); } #[test] fn script_4_2_1_8() { let expr = "zi,j"; test_braille("CMU", expr, "⠵⠡⠢⠊⠀⠂⠚⠔"); } #[test] fn script_4_2_1_9() { // z_{i_r -1} let expr = "zir-1"; test_braille("CMU", expr, "⠵⠌⠢⠊⠌⠗⠤⠼⠁⠔"); } #[test] fn script_4_2_1_10() { // z_i_{r-1} let expr = "zir-1"; test_braille("CMU", expr, "⠵⠌⠊⠌⠢⠗⠤⠼⠁⠔"); } #[test] fn script_4_2_1_11() { // {}^{n-1}z let expr = "zn-1"; test_braille("CMU", expr, "⠵⠈⠡⠢⠝⠤⠼⠁⠔"); } #[test] fn script_4_2_1_12() { // z^{-1/2} let expr = "z-1/2"; test_braille("CMU", expr, "⠵⠡⠤⠼⠁⠆⠀"); } #[test] fn script_4_2_1_13() { // z_i_0 let expr = "zi0"; test_braille("CMU", expr, "⠵⠌⠊⠌⠼⠚"); } #[test] fn prime_4_3_1_0() { let expr = "z"; test_braille("CMU", expr, "⠵⠳⠳"); } #[test] fn super_4_3_1_1() { // z^{+} let expr = "z+"; test_braille("CMU", expr, "⠵⠖⠄"); } #[test] fn degree_4_3_1_3() { let expr = "z°"; test_braille("CMU", expr, "⠵⠴⠄"); } #[test] fn sup_plus_4_3_1_5() { // z^{+++} let expr = "z+++"; test_braille("CMU", expr, "⠵⠖⠖⠖⠄"); } #[test] fn sup_grave_4_3_1_6() { // z^{``} let expr = "z``"; test_braille("CMU", expr, "⠵⠢⠢⠄"); } #[test] fn sup_star_minus_4_3_1_7() { // z^{*-} let expr = "z*-"; test_braille("CMU", expr, "⠵⠲⠤⠄"); } #[test] fn sup_4_3_1_8() { // z^{4*} let expr = "z4*"; test_braille("CMU", expr, "⠵⠡⠼⠙⠲⠄"); } #[test] fn sup_4_3_1_9() { // z^{****} -- need to convert to 4* let expr = "z****"; test_braille("CMU", expr, "⠵⠡⠼⠙⠲⠄"); } #[test] fn sup_4_3_1_10() { // z^\infty let expr = "z"; test_braille("CMU", expr, "⠵⠡⠼⠳⠄"); } #[test] fn bar_4_3_2_1() { let expr = "z¯"; test_braille("CMU", expr, "⠈⠉⠵"); } #[test] fn unicode_bar_4_3_2_1() { // Using U+2550 let expr = "z"; test_braille("CMU", expr, "⠈⠉⠈⠉⠵"); } #[test] fn bar_4_3_2_2() { // A double bar probably should be U+2550, but I don't know how to get a MathML generator to create this // Here we use nested mover's, which doesn't look great let expr = " Z¯ ¯ "; test_braille("CMU", expr, "⠈⠉⠈⠉⠨⠵"); } #[test] fn tilde_4_3_2_3() { let expr = "z~"; test_braille("CMU", expr, "⠐⠢⠵"); } #[test] fn hat_4_3_2_5() { let expr = "z^"; test_braille("CMU", expr, "⠰⠒⠵"); } #[test] fn frown_4_3_2_5() { let expr = "z"; test_braille("CMU", expr, "⠈⠒⠵"); } #[test] fn greek_dot_4_3_2_10() { let expr = "ζ¨"; test_braille("CMU", expr, "⠈⠈⠈⠵"); } #[test] fn dot_4_3_2_11() { // three dots above let expr = "r"; test_braille("CMU", expr, "⠈⠈⠈⠐⠗"); } #[test] fn bar_4_3_2_12() { let expr = "AB¯"; test_braille("CMU", expr, "⠈⠉⠢⠨⠁⠨⠃⠔"); } #[test] fn bar_menclose_4_3_2_12() { let expr = "AB"; test_braille("CMU", expr, "⠈⠉⠢⠨⠁⠨⠃⠔"); } #[test] fn bar_menclose_4_3_2_13() { let expr = "z''"; test_braille("CMU", expr, "⠈⠉⠢⠵⠳⠳⠔"); } #[test] fn over_operator_4_3_2_14() { let expr = "z++"; test_braille("CMU", expr, "⠵⠡⠡⠖⠖⠄"); } #[test] fn wavy_4_3_3_1() { let expr = "z"; test_braille("CMU", expr, "⠂⠢⠵"); } #[test] fn underbar_4_3_3_2() { let expr = "z_"; test_braille("CMU", expr, "⠠⠤⠵"); } #[test] fn underbar_4_3_3_3() { let expr = "z"; test_braille("CMU", expr, "⠠⠤⠠⠤⠵"); } #[test] fn bar_menclose_4_3_3_4() { let expr = "ab"; test_braille("CMU", expr, "⠠⠤⠢⠁⠃⠔"); } #[test] fn bar_menclose_4_3_3_5() { let expr = "z''"; test_braille("CMU", expr, "⠠⠤⠢⠵⠳⠳⠔"); } #[test] fn other_4_3_3_6() { let expr = "z<"; test_braille("CMU", expr, "⠵⠌⠌⠪⠄"); } #[test] fn scripts_4_3_4_1() { let expr = "z+"; test_braille("CMU", expr, "⠵⠌⠖⠄"); } #[test] fn scripts_4_3_4_2() { // needs to convert the "----" to "4-" let expr = "z ----"; test_braille("CMU", expr, "⠵⠈⠡⠼⠙⠤⠄"); } #[test] fn scripts_4_3_4_3() { let expr = " z ++ "; test_braille("CMU", expr, "⠵⠳⠳⠠⠌⠖⠖⠄"); } #[test] fn both_scripts_4_4_1_1() { let expr = "z43"; test_braille("CMU", expr, "⠵⠌⠼⠙⠡⠼⠉"); } #[test] fn both_multiscripts_4_4_1_1() { let expr = "z43"; test_braille("CMU", expr, "⠵⠌⠼⠙⠡⠼⠉"); } #[test] fn both_scripts_4_4_1_2() { let expr = "zi,j2"; test_braille("CMU", expr, "⠵⠌⠢⠊⠀⠂⠚⠔⠡⠼⠃"); } #[test] fn both_multiscripts_4_4_1_2() { let expr = "zi,j2"; test_braille("CMU", expr, "⠵⠌⠢⠊⠀⠂⠚⠔⠡⠼⠃"); } #[test] fn both_scripts_4_4_1_3() { let expr = "z0'"; test_braille("CMU", expr, "⠵⠳⠌⠼⠚"); } #[test] fn both_scripts_4_4_1_4() { let expr = "z'3"; test_braille("CMU", expr, "⠵⠳⠡⠼⠉"); } #[test] fn both_scripts_4_4_1_5() { let expr = "z0"; test_braille("CMU", expr, "⠈⠉⠢⠵⠌⠼⠚⠔"); } #[test] fn both_scripts_4_4_1_6() { let expr = " ( z0 ) 2 "; test_braille("CMU", expr, "⠈⠉⠣⠵⠳⠌⠼⠚⠜⠡⠼⠃"); } #[test] fn both_scripts_4_4_1_7() { let expr = " z0 2 "; test_braille("CMU", expr, "⠈⠉⠢⠵⠳⠌⠼⠚⠔⠡⠼⠃"); } #[test] fn scripts_4_4_2_1() { let expr = "Trs"; test_braille("CMU", expr, "⠨⠞⠌⠗⠘⠡⠎"); } #[test] fn mmultiscripts_4_4_2_1() { let expr = "Trs"; test_braille("CMU", expr, "⠨⠞⠌⠗⠘⠡⠎"); } #[test] fn scripts_4_4_2_2() { let expr = "Trs"; test_braille("CMU", expr, "⠨⠞⠡⠗⠰⠌⠎"); } #[test] fn mmultiscripts_4_4_2_2() { let expr = "Trs"; test_braille("CMU", expr, "⠨⠞⠡⠗⠰⠌⠎"); } #[test] fn scripts_4_4_2_3() { let expr = "Tsr"; test_braille("CMU", expr, "⠨⠞⠌⠎⠡⠗"); } #[test] fn multi_scripts_4_4_2_3() { let expr = "Tsr"; test_braille("CMU", expr, "⠨⠞⠌⠎⠡⠗"); } #[test] fn arith_5_1_1() { let expr = "6+2"; test_braille("CMU", expr, "⠼⠋⠖⠼⠃"); } #[test] fn arith_5_1_2() { let expr = "6-2"; test_braille("CMU", expr, "⠼⠋⠤⠼⠃"); } #[test] fn arith_5_1_3() { let expr = "6×2"; test_braille("CMU", expr, "⠼⠋⠦⠼⠃"); } #[test] fn arith_5_1_4() { let expr = "6·2"; test_braille("CMU", expr, "⠼⠋⠠⠀⠼⠃"); } #[test] fn arith_5_1_5() { let expr = "62"; test_braille("CMU", expr, "⠼⠋⠰⠄⠼⠃"); } #[test] fn arith_5_1_6() { let expr = "3b"; test_braille("CMU", expr, "⠼⠉⠐⠃"); } #[test] fn arith_5_1_7() { let expr = "3a+5x"; test_braille("CMU", expr, "⠼⠉⠐⠁⠖⠼⠑⠭"); } #[test] fn arith_5_1_9() { let expr = "x·y"; test_braille("CMU", expr, "⠭⠠⠀⠽"); } #[test] fn arith_5_1_11() { let expr = "3:4"; test_braille("CMU", expr, "⠼⠉⠐⠂⠼⠙"); } #[test] fn arith_5_1_14() { let expr = "ac·x"; test_braille("CMU", expr, "⠁⠲⠢⠉⠠⠀⠭⠔"); } #[test] fn arith_5_1_15() { let expr = "a+bc"; test_braille("CMU", expr, "⠢⠁⠖⠃⠔⠲⠉"); } #[test] fn arith_5_1_16() { let expr = " a+bc d+e "; test_braille("CMU", expr, "⠢⠁⠖⠃⠲⠉⠔⠲⠢⠙⠖⠑⠔"); } #[test] fn arith_5_1_17() { let expr = "a+b/c"; test_braille("CMU", expr, "⠁⠖⠃⠲⠉"); } #[test] fn arith_5_1_18() { let expr = " a+bc+d x+y "; test_braille("CMU", expr, "⠢⠢⠁⠖⠃⠔⠲⠢⠉⠖⠙⠔⠔⠲⠢⠭⠖⠽⠔"); } #[test] fn arith_5_1_19() { let expr = " 35· 27= 635"; // corrected: output corresponds to using 'x', not '·' as shown in example test_braille("CMU", expr, "⠼⠉⠢⠀⠠⠀⠼⠃⠶⠀⠶⠼⠋⠒⠢⠀"); } #[test] fn power_5_2_3() { let expr = "x-1"; test_braille("CMU", expr, "⠭⠡⠤⠼⠁"); } #[test] fn power_5_2_4() { let expr = "x12"; test_braille("CMU", expr, "⠭⠡⠼⠁⠆⠀"); } #[test] fn power_5_2_5() { let expr = "xa+b"; test_braille("CMU", expr, "⠭⠡⠢⠁⠖⠃⠔"); } #[test] fn power_5_2_6() { let expr = "x-(a+b)"; test_braille("CMU", expr, "⠭⠡⠤⠣⠁⠖⠃⠜"); } #[test] fn power_5_2_7() { let expr = "xn2"; test_braille("CMU", expr, "⠭⠡⠝⠡⠼⠃"); } #[test] fn power_5_2_8() { let expr = "7x3- 2x2+x+1"; test_braille("CMU", expr, "⠼⠛⠭⠡⠼⠉⠤⠼⠃⠭⠡⠼⠃⠖⠭⠖⠼⠁"); } #[test] fn power_5_2_9() { let expr = "3a+12x2y3"; test_braille("CMU", expr, "⠼⠉⠐⠁⠖⠼⠁⠆⠀⠭⠡⠼⠃⠽⠡⠼⠉"); } #[test] fn power_5_2_11() { // 4/3a^2 let expr = "43a2"; test_braille("CMU", expr, "⠼⠙⠲⠢⠼⠉⠐⠁⠡⠼⠃⠔"); } #[test] fn power_5_2_12() { // x^a+b let expr = "xa+b"; test_braille("CMU", expr, "⠭⠡⠁⠖⠃"); } #[test] fn root_5_2_1_1() { let expr = "83"; test_braille("CMU", expr, "⠫⠼⠉⠱⠼⠓"); } #[test] fn root_5_2_1_2() { let expr = "8"; test_braille("CMU", expr, "⠫⠱⠼⠓"); } #[test] fn sqrt_5_3_3() { let expr = "x"; test_braille("CMU", expr, "⠫⠱⠭"); } #[test] fn root_5_2_1_4() { let expr = "a+bn"; test_braille("CMU", expr, "⠫⠝⠱⠢⠁⠖⠃⠔"); } #[test] fn root_5_2_1_5() { let expr = "an+b"; test_braille("CMU", expr, "⠫⠝⠱⠁⠖⠃"); } #[test] fn root_5_2_1_6() { let expr = "an+b"; test_braille("CMU", expr, "⠫⠝⠱⠁⠖⠃"); } #[test] fn root_5_2_1_7() { let expr = "abn-1"; test_braille("CMU", expr, "⠫⠝⠤⠼⠁⠱⠢⠁⠲⠃⠔"); } #[test] fn root_5_2_1_8() { // \sqrt{ \sqrt{8} } let expr = "16"; test_braille("CMU", expr, "⠫⠱⠫⠱⠼⠁⠋"); } #[test] fn root_5_2_1_9() { // \sqrt{ x^2+y^2 } let expr = "x2+y2"; test_braille("CMU", expr, "⠫⠱⠢⠭⠡⠼⠃⠖⠽⠡⠼⠃⠔"); } #[test] fn root_5_2_1_10() { let expr = "3a2-a3 +9"; test_braille("CMU", expr, "⠫⠼⠉⠱⠢⠼⠉⠐⠁⠡⠼⠃⠤⠁⠔⠖⠼⠊"); } #[test] fn factorial_5_3_1() { let expr = "n!"; test_braille("CMU", expr, "⠝⠘⠄"); } #[test] fn binomial_5_3_3() { let expr = " ( nr ) "; test_braille("CMU", expr, "⠨⠣⠝⠒⠗⠜"); } #[test] fn binomial_5_3_4() { let expr = " Cnk = (nk) = n! k!(nk)! "; test_braille("CMU", expr, "⠨⠉⠌⠝⠡⠅⠶⠨⠣⠝⠒⠅⠜⠶⠝⠘⠄⠲⠢⠅⠘⠄⠣⠝⠤⠅⠜⠘⠄⠔"); } #[test] fn binomial_5_3_5() { let expr = " C Rnk = ( n+k1k ) "; test_braille("CMU", expr, "⠨⠉⠨⠗⠌⠝⠡⠅⠶⠨⠣⠝⠖⠅⠤⠼⠁⠒⠅⠜"); } #[test] fn variation_5_3_6() { let expr = "Vnk= nk= n!(n-k)! "; test_braille("CMU", expr, "⠨⠧⠌⠝⠡⠅⠶⠝⠡⠠⠤⠅⠶⠝⠘⠄⠲⠣⠝⠤⠅⠜⠘⠄"); } #[test] fn variation_5_3_8() { let expr = " Vn,k= n(n-1) (n-2) (n-k+1)"; test_braille("CMU", expr, "⠨⠧⠌⠢⠝⠀⠂⠅⠔⠶⠝⠣⠝⠤⠼⠁⠜⠣⠝⠤⠼⠃⠜⠄⠄⠄⠣⠝⠤⠅⠖⠼⠁⠜"); } #[test] fn operators_5_4_1() { let expr = "6±2"; test_braille("CMU", expr, "⠼⠋⠖⠒⠤⠼⠃"); } #[test] fn operators_5_4_2() { let expr = "21%"; test_braille("CMU", expr, "⠼⠃⠁⠸⠴"); } #[test] fn operators_5_4_3() { let expr = "|α|=1"; test_braille("CMU", expr, "⠸⠈⠁⠸⠀⠶⠼⠁"); } #[test] fn sum_5_5_1_1() { let expr = "j=14j2"; test_braille("CMU", expr, "⠘⠎⠚⠶⠼⠁⠒⠼⠙⠱⠚⠡⠼⠃"); } #[test] fn sum_5_5_1_2() { let expr = "(1j4) j2"; test_braille("CMU", expr, "⠘⠎⠼⠁⠪⠶⠚⠪⠶⠼⠙⠱⠚⠡⠼⠃"); } #[test] fn product_5_5_2_1() { let expr = "j=1n Sj"; test_braille("CMU", expr, "⠘⠏⠚⠶⠼⠁⠒⠝⠱⠨⠎⠌⠚"); } #[test] fn product_5_5_2_2() { let expr = "1jn Sj"; test_braille("CMU", expr, "⠘⠏⠼⠁⠪⠶⠚⠪⠶⠝⠱⠨⠎⠌⠚"); } #[test] fn coproduct_5_5_3_1() { let expr = "X=jJ Xj"; test_braille("CMU", expr, "⠨⠭⠶⠘⠻⠚⠣⠂⠨⠚⠱⠨⠭⠌⠚"); } #[test] fn relations_6_1_1() { let expr = "pm·v"; test_braille("CMU", expr, "⠏⠰⠶⠍⠠⠀⠧"); } #[test] fn relations_6_1_2() { let expr = "AB"; test_braille("CMU", expr, "⠨⠁⠐⠶⠄⠨⠃"); } #[test] fn relations_6_1_3() { let expr = "4386"; test_braille("CMU", expr, "⠼⠙⠐⠂⠼⠉⠰⠆⠼⠓⠐⠂⠼⠋"); } #[test] fn set_7_2_1() { let expr = "B={x: x,x<7}"; test_braille("CMU", expr, "⠨⠃⠶⠐⠇⠭⠐⠂⠭⠣⠂⠸⠝⠀⠂⠭⠪⠼⠛⠸⠂"); } #[test] fn set_7_2_2() { let expr = "AB={2,4,6}"; test_braille("CMU", expr, "⠨⠁⠸⠱⠨⠃⠶⠐⠇⠼⠃⠀⠂⠼⠙⠀⠂⠼⠋⠸⠂"); } #[test] fn set_7_2_3() { let expr = "jIAj"; test_braille("CMU", expr, "⠿⠜⠚⠣⠂⠨⠊⠱⠨⠁⠌⠚"); } #[test] fn logic_8_2_1() { let expr = "p,q¬(pq)¬p¬q"; test_braille("CMU", expr, "⠨⠄⠏⠀⠂⠟⠠⠄⠣⠏⠸⠢⠟⠜⠪⠒⠕⠠⠄⠏⠸⠊⠠⠄⠟"); } #[test] fn logic_8_2_2() { let expr = "p:q~p="; test_braille("CMU", expr, "⠘⠨⠢⠏⠐⠂⠟⠸⠢⠠⠄⠏⠶⠸⠶"); } #[test] fn inverse_9_1_1() { let expr = "f"; test_braille("CMU", expr, "⠒⠋⠒⠂"); } #[test] fn list_9_1_2() { let expr = "(x1,x2)"; test_braille("CMU", expr, "⠣⠭⠌⠼⠁⠀⠂⠭⠌⠼⠃⠜"); } #[test] fn list_9_1_3() { let expr = "12,32"; test_braille("CMU", expr, "⠣⠼⠁⠆⠀⠂⠼⠉⠆⠀⠜"); } #[test] fn function_map_9_1_4() { let expr = "f:AB"; test_braille("CMU", expr, "⠋⠐⠂⠨⠁⠒⠒⠂⠨⠃"); } #[test] fn arrow_inverse_9_1_6() { // note: there appears to be an abbreviated form for x^{-1}, maybe for 'x' being a single letter? Not explained in the spec. let expr = "Bf-1A"; test_braille("CMU", expr, "⠨⠃⠒⠋⠡⠤⠼⠁⠒⠂⠨⠁"); } #[test] fn arrow_9_1_8() { let expr = "AB"; test_braille("CMU", expr, "⠨⠁⠐⠒⠒⠂⠨⠃"); } #[test] fn congruence_9_1_10() { let expr = "f0"; test_braille("CMU", expr, "⠋⠶⠶⠼⠚"); } #[test] fn composition_9_1_11() { let expr = "fg(x)= f(g(x))"; test_braille("CMU", expr, "⠋⠠⠆⠛⠣⠭⠜⠶⠋⠣⠛⠣⠭⠜⠜"); } #[test] fn interval_9_1_12() { // note: there appears to be an abbreviated form for x^{-1}, maybe for 'x' being a single letter? Not explained in the spec. let expr = "]a,b["; test_braille("CMU", expr, "⠾⠁⠀⠂⠃⠷"); } #[test] fn limit_line_over_9_2_0() { let expr = "lim¯"; test_braille("CMU", expr, "⠈⠉⠇⠊⠍⠄"); } #[test] fn limit_line_under_9_2_0() { let expr = "lim¯"; test_braille("CMU", expr, "⠠⠤⠇⠊⠍⠄"); } #[test] fn limit_9_2_3() { let expr = "limxc"; test_braille("CMU", expr, "⠇⠊⠍⠄⠭⠒⠂⠉⠱"); } #[test] fn limit_9_2_4() { let expr = "limxc"; test_braille("CMU", expr, "⠇⠊⠍⠄⠭⠸⠁⠉⠱"); } #[test] fn limit_9_2_5() { let expr = "limx0-"; test_braille("CMU", expr, "⠇⠊⠍⠄⠭⠒⠂⠼⠚⠤⠄⠱"); } #[test] fn limit_9_2_6() { let expr = "limxc"; test_braille("CMU", expr, "⠇⠊⠍⠄⠭⠸⠄⠉⠱"); } #[test] fn limit_9_2_8() { let expr = " limxc (f(x)+g(x)) = limxc f(x)+ limxc g(x) "; test_braille("CMU", expr, "⠇⠊⠍⠄⠭⠒⠂⠉⠱⠣⠋⠣⠭⠜⠖⠛⠣⠭⠜⠜⠶⠇⠊⠍⠄⠭⠒⠂⠉⠱⠋⠣⠭⠜⠖⠇⠊⠍⠄⠭⠒⠂⠉⠱⠛⠣⠭⠜"); } #[test] fn deriv_9_3_1() { let expr = "dfdx"; test_braille("CMU", expr, "⠢⠙⠋⠔⠲⠢⠙⠭⠔"); } #[test] fn deriv_9_3_2() { let expr = "ddxf"; test_braille("CMU", expr, "⠙⠲⠢⠙⠭⠔⠋"); } #[test] fn deriv_9_3_5() { let expr = " dnf dxn "; test_braille("CMU", expr, "⠢⠙⠡⠝⠋⠔⠲⠢⠙⠭⠡⠝⠔"); } #[test] fn deriv_9_3_6() { let expr = " dn dxn f"; test_braille("CMU", expr, "⠙⠡⠝⠲⠢⠙⠭⠡⠝⠔⠋"); } #[test] fn partial_9_3_15() { let expr = " 2 xy "; test_braille("CMU", expr, "⠸⠙⠡⠼⠃⠲⠢⠸⠙⠭⠸⠙⠽⠔"); } #[test] fn partial_9_3_16() { let expr = " 2f xy "; test_braille("CMU", expr, "⠢⠸⠙⠡⠼⠃⠐⠋⠔⠲⠢⠸⠙⠭⠸⠙⠽⠔"); } #[test] fn partial_9_3_17() { let expr = " m+n xmyn "; test_braille("CMU", expr, "⠸⠙⠡⠢⠍⠖⠝⠔⠲⠢⠸⠙⠭⠡⠍⠸⠙⠽⠡⠝⠔"); } #[test] fn partial_9_3_18() { let expr = " m+nf xmyn "; test_braille("CMU", expr, "⠢⠸⠙⠡⠢⠍⠖⠝⠔⠋⠔⠲⠢⠸⠙⠭⠡⠍⠸⠙⠽⠡⠝⠔"); } #[test] fn integral_9_4_0() { // countour integral over C let expr = "C"; test_braille("CMU", expr, "⠯⠴⠨⠉⠱"); } #[test] fn integral_9_4_1() { let expr = "x2dx"; test_braille("CMU", expr, "⠯⠱⠭⠡⠼⠃⠐⠙⠭"); } #[test] fn integral_9_4_2() { let expr = " 14 x2 d x = 13x3 1 4 = 21 "; test_braille("CMU", expr, "⠯⠼⠁⠒⠼⠙⠱⠭⠡⠼⠃⠐⠙⠭⠶⠷⠼⠁⠒⠀⠭⠡⠼⠉⠾⠌⠼⠁⠡⠼⠙⠶⠼⠃⠁"); } #[test] fn succession_10_1_1_1() { let expr = "(sn)"; test_braille("CMU", expr, "⠣⠎⠌⠝⠜"); } #[test] fn lim_10_1_1_6() { let expr = "limn Sn"; test_braille("CMU", expr, "⠇⠊⠍⠄⠝⠒⠂⠼⠳⠱⠨⠎⠌⠝"); } #[test] fn series_10_1_3_1() { let expr = " n=1 1n2= limk n=1k 1n2= 1+ 14+ 19+ 116+ "; // it looks like the spec is wrong -- correct to add "⠀⠖" near the end test_braille("CMU", expr, "⠘⠎⠝⠶⠼⠁⠒⠼⠳⠱⠼⠁⠲⠝⠡⠼⠃⠶⠇⠊⠍⠄⠅⠒⠂⠼⠳⠱⠘⠎⠝⠶⠼⠁⠒⠅⠱⠼⠁⠲⠝⠡⠼⠃⠶⠼⠁⠖⠼⠁⠲⠀⠖⠼⠁⠔⠀⠖⠼⠁⠂⠖⠀⠖⠄⠄⠄"); } #[test] fn log_10_2_2() { let expr = "logbx"; test_braille("CMU", expr, "⠇⠕⠛⠄⠃⠱⠭"); } #[test] fn log_10_2_4() { let expr = "Lnx"; test_braille("CMU", expr, "⠇⠝⠄⠭"); } #[test] fn log_10_2_5() { let expr = "lnx"; test_braille("CMU", expr, "⠇⠝⠄⠭"); } #[test] fn log_10_2_6() { let expr = "alogx"; test_braille("CMU", expr, "⠁⠇⠕⠛⠄⠭"); } #[test] fn log_10_2_7() { let expr = "antilogx"; test_braille("CMU", expr, "⠁⠝⠞⠊⠇⠕⠛⠄⠭"); } #[test] #[ignore] fn log_10_2_10() { let expr = "log0,2=1¯,30103"; test_braille("CMU", expr, "⠇⠕⠛⠄⠼⠚⠂⠃⠶⠼⠥⠂⠉⠚⠁⠚⠉"); } #[test] fn ray_11_1_1() { let expr = "r"; test_braille("CMU", expr, "⠐⠒⠂⠗"); } #[test] fn ray_11_1_2() { let expr = "PQ"; test_braille("CMU", expr, "⠐⠒⠂⠢⠨⠏⠨⠟⠔"); } #[test] fn ray_11_1_3() { let expr = "z"; test_braille("CMU", expr, "⠒⠂⠵"); } #[test] fn ray_11_1_4() { let expr = "z"; test_braille("CMU", expr, "⠐⠒⠵"); } #[test] fn angle_11_1_7() { let expr = "A^"; test_braille("CMU", expr, "⠘⠒⠨⠁"); } #[test] fn angle_11_1_8() { let expr = "aob^"; test_braille("CMU", expr, "⠘⠒⠢⠁⠕⠃⠔"); } #[test] fn vector_11_2_3() { let expr = "v"; test_braille("CMU", expr, "⠸⠀⠒⠂⠧⠸⠀"); } #[test] fn vector_11_2_4() { let expr = "v"; test_braille("CMU", expr, "⠸⠇⠒⠂⠧⠸⠇"); } #[test] fn vector_11_2_5() { let expr = "AB"; // modified to include space at end as in vector_11_2_3 test_braille("CMU", expr, "⠸⠀⠒⠂⠢⠨⠁⠨⠃⠔⠸⠀"); } #[test] fn vector_11_2_6() { let expr = "AB"; test_braille("CMU", expr, "⠸⠇⠒⠂⠢⠨⠁⠨⠃⠔⠸⠇"); } #[test] fn vector_11_2_9() { let expr = "AB"; test_braille("CMU", expr, "⠷⠒⠂⠢⠨⠁⠨⠃⠔⠾"); } #[test] fn parallel_11_3_1() { let expr = "lMN"; test_braille("CMU", expr, "⠐⠒⠂⠇⠸⠇⠈⠉⠢⠨⠍⠨⠝⠔"); } #[test] fn perpendicular_11_3_2() { let expr = "ABOX"; test_braille("CMU", expr, "⠐⠒⠂⠢⠨⠁⠨⠃⠔⠼⠄⠒⠂⠢⠨⠕⠨⠭⠔"); } #[test] fn vector_11_4_1() { let expr = "v·w"; test_braille("CMU", expr, "⠒⠂⠧⠠⠀⠒⠂⠺"); } #[test] fn vector_11_4_2() { let expr = "v,w"; test_braille("CMU", expr, "⠐⠅⠒⠂⠧⠀⠂⠒⠂⠺⠨⠂"); } #[test] fn vector_11_4_3() { let expr = "v×w"; test_braille("CMU", expr, "⠒⠂⠧⠈⠦⠒⠂⠺"); } #[test] fn vector_11_4_4() { let expr = "v+w"; test_braille("CMU", expr, "⠒⠂⠧⠖⠒⠂⠺"); } #[test] fn degrees_11_5_1() { let expr = "90°"; test_braille("CMU", expr, "⠼⠊⠚⠴"); } #[test] fn degrees_11_5_2() { let expr = "37°22'49''"; test_braille("CMU", expr, "⠼⠉⠛⠴⠼⠃⠃⠳⠼⠙⠊⠳⠳"); } #[test] fn triangle_11_6() { let expr = "abc"; test_braille("CMU", expr, "⠠⠾⠁⠃⠉"); } #[test] fn cancellation_14_3_3() { // this uses various forms of crossouts to make the test better -- the original only has horizontal crossouts. All should have the same braille. let expr = " 2x (x-2) (x-1) 3 2x (x+1) (x-1) "; test_braille("CMU", expr, "⠢⠻⠢⠼⠃⠭⠔⠣⠭⠤⠼⠃⠜⠻⠢⠣⠭⠤⠼⠁⠜⠡⠼⠉⠔⠔⠲⠢⠻⠢⠼⠃⠭⠔⠣⠭⠖⠼⠁⠜⠻⠣⠭⠤⠼⠁⠜⠔"); } // FIX: add tests for color #[test] fn omission_14_5_1() { // Single and double '_' are used (from WIRIS) for a more robust test -- example seems to use two "_"s for a blank (added 'intent') let expr = "5_4__2=10"; test_braille("CMU", expr, "⠼⠑⠰⠼⠙⠰⠼⠃⠶⠼⠁⠚"); } #[test] fn omission_14_5_2() { // copied from example and pasted into WIRIS let expr = "12+13=_ _"; test_braille("CMU", expr, "⠼⠁⠃⠖⠼⠁⠉⠶⠼⠰⠰"); } #[test] fn omission_14_5_3() { // copied from example and pasted into WIRIS let expr = "23+145=1_ _"; test_braille("CMU", expr, "⠼⠃⠉⠖⠼⠁⠙⠑⠶⠼⠁⠰⠰"); } #[test] fn omission_14_5_4() { // copied from example and pasted into WIRIS let expr = "719+83=__"; test_braille("CMU", expr, "⠼⠛⠁⠊⠖⠼⠓⠉⠶⠰⠤⠆"); } #[test] fn omission_14_5_5() { let expr = "3÷12=18÷   "; test_braille("CMU", expr, "⠼⠉⠂⠆⠀⠶⠼⠁⠓⠲⠰⠤⠆"); } #[test] fn units_appendix_1_2_1() { let expr = " J = kg   m2   s-2 "; test_braille("CMU", expr, "⠨⠚⠶⠅⠛⠀⠍⠡⠼⠃⠀⠎⠡⠤⠼⠃"); } #[test] fn units_appendix_1_3_1() { // manually added "intent" -- should have another test let expr = "1 m=100 cm=0,1 km"; test_braille_prefs("CMU", vec![("DecimalSeparators", ","), ("BlockSeparators", ". ")], expr, "⠼⠁⠀⠍⠶⠼⠁⠚⠚⠀⠉⠍⠶⠼⠚⠂⠁⠀⠅⠍"); } #[test] #[ignore] // remove 'ignore' once MathCAT adds code to deal with Units/inferring units fn units_appendix_1_3_1_auto_intent() { // manually added "intent" -- should have another test let expr = "1 m=100 cm=0,1 km"; test_braille_prefs("CMU", vec![("DecimalSeparators", ","), ("BlockSeparators", ". ")], expr, "⠼⠁⠀⠍⠶⠼⠁⠚⠚⠀⠉⠍⠶⠼⠚⠂⠁⠀⠅⠍"); } // ********************************************************* // FIX: add 2.6 (Chemistry) // FIX: add 3.2.1 (repeating numbers) // FIX: add 3.4 math variants // FIX: add 3.6 ordinals (drop numbers) #[test] fn roman_numerals_simple() { // not in spec, but the spec example is very complicated. Here's a simpler test that tests for a single cap indicator let expr = "XVI"; test_braille("CMU", expr, "⠨⠭⠧⠊"); } #[test] #[ignore] fn roman_numerals_appendix_2_2_1() { let expr = " VI XL DXXI "; test_braille("CMU", expr, "⠨⠧⠊⠒⠒⠭⠇⠒⠙⠭⠭⠊"); } #[test] fn money_appendix_2_3_1() { let expr = "$10=1000¢"; test_braille("CMU", expr, "⠸⠏⠼⠁⠚⠶⠼⠁⠚⠚⠚⠘⠉"); } #[test] fn money_appendix_2_3_2() { let expr = "5$=4,23"; test_braille("CMU", expr, "⠼⠑⠸⠎⠶⠼⠙⠂⠃⠉⠸⠑"); }