// UEB tests for the basic mathml tags // Initial tests are from BANA guidelines, mostly about initial chars for code switching // http://www.brailleauthority.org/ueb/ueb_math_guidance/final_for_posting_ueb_math_guidance_may_2019_102419.pdf // These tests start with "bana_" // // Many come from (refer to) https://iceb.org/guidelines_for_technical_material_2014.pdf // For example, "fraction_6_1_1" is a fraction example from section 6.1, and is the first example there. use crate::common::*; #[test] fn bana_2_1() { let expr = "6=1×2×3 =1+2+3"; test_braille("UEB", expr, "⠼⠋⠀⠐⠶⠀⠼⠁⠐⠦⠼⠃⠐⠦⠼⠉⠀⠐⠶⠀⠼⠁⠐⠖⠼⠃⠐⠖⠼⠉"); } #[test] fn bana_5_1() { let expr = "x+y=6"; test_braille("UEB", expr, "⠭⠐⠖⠽⠀⠐⠶⠀⠼⠋"); } #[test] fn bana_5_2() { let expr = "x2+y2=C"; test_braille("UEB", expr, "⠭⠰⠔⠼⠃⠐⠖⠽⠔⠼⠃⠀⠐⠶⠀⠰⠠⠉"); } #[test] fn bana_5_3() { let expr = "ab+cd"; test_braille("UEB", expr, "⠰⠰⠷⠁⠨⠌⠃⠾⠐⠖⠷⠉⠨⠌⠙⠾"); } #[test] fn bana_5_4() { let expr = "an×am= an+m"; test_braille("UEB", expr, "⠰⠰⠰⠁⠔⠝⠐⠦⠁⠔⠍⠀⠐⠶⠀⠁⠔⠣⠝⠐⠖⠍⠜⠰⠄"); } #[test] fn bana_5_5() { let expr = "logxy"; // BANA example contradicts GTM 9.2 that says don't use a space after a function name if there is an intervening indicator. // Corrected: removed the space and the G1 indicator needed if a space were inserted test_braille("UEB", expr, "⠰⠰⠇⠕⠛⠢⠭⠽"); } #[test] fn bana_5a_1() { let expr = "100°F"; test_braille("UEB", expr, "⠼⠁⠚⠚⠘⠚⠠⠋"); } #[test] fn bana_5a_1_baseline() { let expr = "100°F"; test_braille("UEB", expr, "⠼⠁⠚⠚⠘⠚⠠⠋"); } #[test] fn bana_5a_2() { let expr = "25 km2"; test_braille("UEB", expr, "⠼⠃⠑⠀⠅⠍⠰⠔⠼⠃"); } #[test] fn bana_5a_2_mtext() { let expr = "25 km2"; test_braille("UEB", expr, "⠼⠃⠑⠀⠅⠍⠰⠔⠼⠃"); } #[test] fn bana_5a_3() { let expr = "6 m  s-1"; test_braille("UEB", expr, "⠼⠋⠀⠰⠍⠀⠰⠰⠎⠔⠣⠐⠤⠼⠁⠜"); } #[test] fn bana_6_1() { let expr = "x+y=z =t2."; test_braille("UEB", expr, "⠰⠰⠰⠭⠐⠖⠽⠀⠐⠶⠀⠵⠀⠐⠶⠀⠞⠔⠼⠃⠲⠰⠄"); } #[test] fn cap_1_6_1() { let expr = "ABCD"; test_braille("UEB", expr, "⠠⠠⠁⠃⠉⠙"); } #[test] fn cap_1_6_1_separate() { let expr = " A B C D"; test_braille("UEB", expr, "⠠⠠⠁⠃⠉⠙"); } #[test] fn cap_1_6_2() { let expr = "V=IR"; test_braille("UEB", expr, "⠰⠠⠧⠀⠐⠶⠀⠠⠠⠊⠗"); } #[test] fn cap_1_6_4() { let expr = "AB2"; test_braille("UEB", expr, "⠠⠠⠁⠃⠰⠔⠼⠃"); } #[test] fn grade1_1_7_1() { let expr = "3-2 12="; // removed the spaces around the '-' from the braille -- they typically wouldn't be used test_braille("UEB", expr, "⠼⠉⠐⠤⠼⠃⠼⠁⠌⠃⠀⠐⠶"); } #[test] fn grade1_1_7_2() { let expr = "y=x+4c"; test_braille("UEB", expr, "⠰⠽⠀⠐⠶⠀⠭⠐⠖⠼⠙⠰⠉"); } #[test] fn grade1_1_7_3_1() { let expr = " 3x4y+ y2 = x2 "; // GTM says it can be either "⠼⠉⠭⠐⠤⠼⠙⠽⠐⠖⠽⠔⠼⠃⠀⠐⠶⠀⠭⠰⠔⠼⠃" or "⠰⠰⠰⠼⠉⠭⠐⠤⠼⠙⠽⠐⠖⠽⠔⠼⠃⠀⠐⠶⠀⠭⠔⠼⠃⠰⠄" test_braille("UEB", expr, "⠼⠉⠭⠐⠤⠼⠙⠽⠐⠖⠽⠔⠼⠃⠀⠐⠶⠀⠭⠰⠔⠼⠃"); } #[test] fn grade1_1_7_3_2() { let expr = " x2+2x 1+x2 =1 "; test_braille("UEB", expr, "⠰⠰⠷⠭⠔⠼⠃⠐⠖⠼⠃⠭⠨⠌⠼⠁⠐⠖⠭⠔⠼⠃⠾⠀⠐⠶⠀⠼⠁"); } #[test] fn grade1_1_7_4() { let expr = " (yx2) "; test_braille("UEB", expr, "⠰⠰⠩⠐⠣⠽⠐⠤⠭⠔⠼⠃⠐⠜⠬"); } #[test] fn number_2_1_2() { let expr = "3,000"; test_braille("UEB", expr, "⠼⠉⠂⠚⠚⠚"); } #[test] fn number_2_1_3() { let expr = "5 000 000"; test_braille("UEB", expr, "⠼⠑⠐⠚⠚⠚⠐⠚⠚⠚"); } #[test] fn number_2_2_1() { let expr = "8.93"; test_braille("UEB", expr, "⠼⠓⠲⠊⠉"); } #[test] fn number_2_2_2() { let expr = "0.7"; test_braille("UEB", expr, "⠼⠚⠲⠛"); } #[test] fn number_2_2_3() { let expr = ".7"; test_braille("UEB", expr, "⠼⠲⠛"); } #[test] fn time_2_4_1() { let expr = "5:30 pm"; test_braille("UEB", expr, "⠼⠑⠒⠼⠉⠚⠀⠏⠍"); } #[test] fn time_2_4_1_mtext() { // this was a bug when only mtext occurred let expr = "5:30"; test_braille("UEB", expr, "⠼⠑⠒⠼⠉⠚"); } #[test] fn roman_numeral_2_6_1() { let expr = " I,  II  and V"; test_braille("UEB", expr, "⠠⠊⠂⠀⠠⠠⠊⠊⠀⠯⠀⠰⠠⠧"); } #[test] fn roman_numeral_2_6_2() { let expr = " i,  vi  and x"; test_braille("UEB", expr, "⠊⠂⠀⠧⠊⠀⠯⠀⠰⠭"); } #[test] fn roman_numeral_2_6_3() { let expr = "CD"; test_braille("UEB", expr, "⠰⠠⠠⠉⠙"); } #[test] fn bold_2_7_1() { let expr = "67𝟖45"; test_braille("UEB", expr, "⠼⠋⠛⠘⠆⠼⠓⠙⠑"); } #[test] fn bold_2_7_2() { let expr = "67845"; test_braille("UEB", expr, "⠼⠋⠛⠘⠂⠼⠓⠙⠑"); } #[test] fn bold_2_7_3() { let expr = "67845"; test_braille("UEB", expr, "⠼⠋⠛⠘⠂⠼⠓⠙⠘⠄⠼⠑"); } #[test] fn signs_2_10_2() { let expr = "$0.30,  30c  or 30¢"; test_braille("UEB", expr, "⠈⠎⠼⠚⠲⠉⠚⠂⠀⠼⠉⠚⠰⠉⠀⠕⠗⠀⠼⠉⠚⠈⠉"); } #[test] fn signs_2_10_5() { let expr = "1 ft 6 in  or  1 6"; test_braille("UEB", expr, "⠼⠁⠀⠋⠞⠀⠼⠋⠀⠔⠀⠕⠗⠀⠼⠁⠶⠀⠼⠋⠶⠶"); } #[test] fn signs_2_10_8() { let expr = "0°C or  32°F"; test_braille("UEB", expr, "⠼⠚⠘⠚⠠⠉⠀⠕⠗⠀⠼⠉⠃⠘⠚⠠⠋"); } #[test] fn signs_2_10_16() { let expr = "1 Å= 110,000  μ"; test_braille("UEB", expr, "⠼⠁⠀⠠⠘⠫⠁⠀⠐⠶⠀⠼⠁⠌⠁⠚⠂⠚⠚⠚⠀⠨⠍"); } #[test] fn expr_3_1_1_spaces() { let expr = "3+5=8"; test_braille_prefs("UEB", vec![("UEB_UseSpacesAroundAllOperators", "true")], expr, "⠼⠉⠀⠐⠖⠀⠼⠑⠀⠐⠶⠀⠼⠓"); } #[test] fn expr_3_1_2_spaces() { let expr = "8-5=3"; test_braille_prefs("UEB", vec![("UEB_UseSpacesAroundAllOperators", "true")], expr, "⠼⠓⠀⠐⠤⠀⠼⠑⠀⠐⠶⠀⠼⠉"); } #[test] fn expr_3_1_1() { let expr = "3+5=8"; // correct not to use extra spacing test_braille("UEB", expr, "⠼⠉⠐⠖⠼⠑⠀⠐⠶⠀⠼⠓"); } #[test] fn expr_3_1_2() { let expr = "8-5=3"; // correct not to use extra spacing test_braille("UEB", expr, "⠼⠓⠐⠤⠼⠑⠀⠐⠶⠀⠼⠉"); } #[test] fn expr_3_1_3() { let expr = "3×5=5×3=15"; test_braille("UEB", expr, "⠼⠉⠐⠦⠼⠑⠀⠐⠶⠀⠼⠑⠐⠦⠼⠉⠀⠐⠶⠀⠼⠁⠑"); } #[test] fn expr_3_1_6() { // example includes spaces, so does the MathML (from WIRIS) let expr = "5.72 m÷10= 57.2 cm"; test_braille("UEB", expr, "⠼⠑⠲⠛⠃⠀⠍⠐⠌⠼⠁⠚⠀⠐⠶⠀⠼⠑⠛⠲⠃⠀⠉⠍"); } #[test] fn expr_3_1_7() { let expr = "15±0.5"; test_braille("UEB", expr, "⠼⠁⠑⠸⠖⠼⠚⠲⠑"); } #[test] fn expr_3_1_8() { let expr = "Area=bh= 5·3=15"; test_braille("UEB", expr, "⠠⠜⠑⠁⠀⠐⠶⠀⠃⠓⠀⠐⠶⠀⠼⠑⠐⠲⠼⠉⠀⠐⠶⠀⠼⠁⠑"); } #[test] fn expr_3_1_9_wiris() { let expr = "3.9×4.116"; test_braille("UEB", expr, "⠼⠉⠲⠊⠐⠦⠼⠙⠲⠁⠀⠸⠔⠀⠼⠁⠋"); } #[test] fn expr_3_1_9() { let expr = "3.9×4.116"; test_braille("UEB", expr, "⠼⠉⠲⠊⠐⠦⠼⠙⠲⠁⠀⠸⠔⠀⠼⠁⠋"); } #[test] fn expr_3_1_10() { let expr = "5-33-5"; test_braille("UEB", expr, "⠼⠑⠐⠤⠼⠉⠀⠐⠶⠈⠱⠀⠼⠉⠐⠤⠼⠑"); } #[test] fn ratio_3_1_11() { let expr = "1:200"; test_braille("UEB", expr, "⠼⠁⠒⠼⠃⠚⠚"); } #[test] fn ratio_3_1_12() { let expr = "2:4=6:12"; test_braille("UEB", expr, "⠼⠃⠒⠼⠙⠀⠐⠶⠀⠼⠋⠒⠼⠁⠃"); } #[test] fn alg_3_2_1_1() { let expr = "yx"; test_braille("UEB", expr, "⠰⠽⠀⠸⠐⠶⠀⠰⠭"); } #[test] fn alg_3_2_1_2() { let expr = "y=kx"; test_braille("UEB", expr, "⠰⠽⠀⠐⠶⠀⠅⠭"); } #[test] fn alg_3_2_2() { let expr = "0θ 2π"; test_braille("UEB", expr, "⠼⠚⠀⠸⠈⠣⠀⠨⠹⠀⠸⠈⠣⠀⠼⠃⠨⠏"); } #[test] fn alg_3_2_3() { let expr = "y=x+4"; test_braille("UEB", expr, "⠰⠽⠀⠐⠶⠀⠭⠐⠖⠼⠙"); } #[test] fn alg_3_2_4() { let expr = "2y=2c-4"; test_braille("UEB", expr, "⠼⠃⠽⠀⠐⠶⠀⠼⠃⠰⠉⠐⠤⠼⠙"); } #[test] fn alg_3_2_5() { let expr = "d+ab=ac"; // BANA says use a word indicator if G1 not in first 3 cells (it is after the '='); use passage if >=2 whitespace // This seems like a poor choice in this case since there is only one G1 indicator, but that's the BANA guidance so... // "⠰⠰⠰⠙⠐⠖⠁⠃⠀⠐⠶⠀⠁⠉⠰⠄" // GTM says to use the following and it is more sensisble, so I'm going with it test_braille("UEB", expr, "⠙⠐⠖⠁⠃⠀⠐⠶⠀⠰⠁⠉"); } #[test] fn ratio_3_2_6() { // the difference from ratio_3_1_12 is this involves letters let expr = "x:y"; test_braille("UEB", expr, "⠭⠰⠒⠽"); } #[test] fn standing_alone_1() { // Tests bug: github.com/NSoiffer/MathCAT/issues/142 let expr = "(n=7)"; test_braille("UEB", expr, "⠐⠣⠰⠝⠀⠐⠶⠀⠼⠛⠐⠜"); } #[test] fn example_3_4_1() { let expr = "-4 to +5"; test_braille("UEB", expr, "⠐⠤⠼⠙⠀⠞⠕⠀⠐⠖⠼⠑"); } #[test] fn example_3_4_2() { // removed some cruft from TeX output of {}^{-}2+{}^{+}3, but the basics are preserved let expr = " 2 + 3 "; test_braille("UEB", expr, "⠰⠔⠐⠤⠼⠃⠐⠖⠔⠐⠤⠼⠉"); } #[test] fn omission_3_6_1() { let expr = "3+7="; test_braille("UEB", expr, "⠼⠉⠐⠖⠼⠛⠀⠐⠶⠀⠐⠠⠤"); } #[test] fn omission_3_6_2() { let expr = "3+7=_"; test_braille("UEB", expr, "⠼⠉⠐⠖⠼⠛⠀⠐⠶⠀⠨⠤"); } #[test] fn omission_3_6_3() { let expr = "3+7=?"; test_braille("UEB", expr, "⠼⠉⠐⠖⠼⠛⠀⠐⠶⠀⠰⠦"); } #[test] fn omission_3_6_4() { let expr = "37=10"; test_braille("UEB", expr, "⠼⠉⠫⠼⠙⠱⠼⠛⠀⠐⠶⠀⠼⠁⠚"); } #[test] fn omission_3_6_5() { let expr = "3  7=10"; test_braille("UEB", expr, "⠼⠉⠬⠼⠛⠀⠐⠶⠀⠼⠁⠚"); } #[test] fn omission_3_6_6() { // comes from WIRIS let expr = "912=3"; test_braille("UEB", expr, "⠼⠊⠌⠁⠃⠀⠐⠶⠀⠰⠷⠼⠉⠨⠌⠬⠾"); } #[test] fn omission_3_6_7() { // comes from MathType let expr = "5="; test_braille("UEB", expr, "⠼⠑⠀⠐⠶⠀⠰⠰⠩⠬⠬"); } #[test] fn fraction_6_1_1() { let expr = "58"; test_braille("UEB", expr, "⠼⠑⠌⠓"); } #[test] fn fraction_6_1_2() { let expr = "5.72,000"; test_braille("UEB", expr, "⠼⠑⠲⠛⠌⠃⠂⠚⠚⠚"); } #[test] fn fraction_6_2_1() { let expr = "212"; test_braille("UEB", expr, "⠼⠃⠼⠁⠌⠃"); } #[test] fn fraction_6_2_2() { let expr = "1750  cm= 134  m"; test_braille("UEB", expr, "⠼⠁⠛⠑⠚⠀⠉⠍⠀⠐⠶⠀⠼⠁⠼⠉⠌⠙⠀⠰⠍"); } #[test] fn fraction_6_2_2_unicode_frac() { let expr = "1750  cm= 1¾  m"; test_braille("UEB", expr, "⠼⠁⠛⠑⠚⠀⠉⠍⠀⠐⠶⠀⠼⠁⠼⠉⠌⠙⠀⠰⠍"); } #[test] fn fraction_6_3_1() { let expr = "3/8"; test_braille("UEB", expr, "⠼⠉⠸⠌⠼⠓"); } #[test] fn fraction_6_4_1() { let expr = "y=x2"; test_braille("UEB", expr, "⠰⠰⠰⠽⠀⠐⠶⠀⠷⠭⠨⠌⠼⠃⠾⠰⠄"); } #[test] fn fraction_6_4_2() { let expr = " 212 x+y "; test_braille("UEB", expr, "⠰⠷⠼⠃⠼⠁⠌⠃⠨⠌⠭⠐⠖⠽⠾"); } #[test] fn fraction_6_4_3() { let expr = "2/35"; test_braille("UEB", expr, "⠰⠷⠼⠃⠸⠌⠼⠉⠨⠌⠼⠑⠾"); } #[test] fn fraction_6_4_4() { let expr = " x2+y3 x+y "; test_braille("UEB", expr, "⠰⠰⠷⠷⠭⠨⠌⠼⠃⠾⠐⠖⠷⠽⠨⠌⠼⠉⠾⠨⠌⠭⠐⠖⠽⠾"); } #[test] fn fraction_6_4_5() { let expr = " x2+y3 x+y "; test_braille("UEB", expr, "⠰⠰⠷⠷⠭⠨⠌⠼⠃⠾⠐⠖⠷⠽⠨⠌⠼⠉⠾⠨⠌⠭⠐⠖⠽⠾"); } #[test] fn fraction_6_4_6() { let expr = "speed=distancetime"; // GTM lists two options: "⠎⠏⠑⠫⠀⠐⠶⠀⠰⠰⠷⠙⠊⠎⠞⠁⠝⠉⠑⠨⠌⠞⠊⠍⠑⠾" and "⠰⠰⠰⠎⠏⠑⠑⠙⠀⠐⠶⠀⠷⠙⠊⠎⠞⠁⠝⠉⠑⠨⠌⠞⠊⠍⠑⠾⠰⠄" test_braille("UEB", expr, "⠎⠏⠑⠫⠀⠐⠶⠀⠰⠰⠷⠙⠊⠎⠞⠁⠝⠉⠑⠨⠌⠞⠊⠍⠑⠾"); } #[test] fn msup_7_3_2() { let expr = "x2y"; test_braille("UEB", expr, "⠭⠰⠔⠼⠃⠽"); } #[test] fn msup_7_3_3() { let expr = "x2y"; test_braille("UEB", expr, "⠰⠰⠭⠔⠣⠼⠃⠽⠜"); } #[test] fn msup_7_3_4() { let expr = "xy+1"; test_braille("UEB", expr, "⠭⠰⠔⠽⠐⠖⠼⠁"); } #[test] fn msup_7_3_6() { let expr = "xy+1+3"; test_braille("UEB", expr, "⠰⠰⠭⠔⠣⠽⠐⠖⠼⠁⠜⠐⠖⠼⠉"); } #[test] fn msup_7_3_7() { let expr = "x"; test_braille("UEB", expr, "⠭⠰⠔⠼⠃⠌⠉"); } #[test] fn msup_7_3_11() { let expr = "xaby=x"; test_braille("UEB", expr, "⠰⠰⠰⠭⠔⠷⠁⠨⠌⠃⠾⠽⠀⠐⠶⠀⠭⠰⠄"); } #[test] fn msup_7_4_1() { let expr = "ex2"; test_braille("UEB", expr, "⠰⠰⠑⠔⠣⠭⠔⠼⠃⠜"); } #[test] fn msup_7_4_2() { let expr = "e(x2)"; test_braille("UEB", expr, "⠰⠰⠑⠔⠐⠣⠭⠔⠼⠃⠐⠜"); } #[test] fn msub_7_4_3() { let expr = "Pxi"; test_braille("UEB", expr, "⠰⠰⠠⠏⠢⠣⠭⠢⠊⠜"); } #[test] fn msup_7_5_1() { let expr = "0.0045= 4.5×10-3 "; test_braille("UEB", expr, "⠼⠚⠲⠚⠚⠙⠑⠀⠐⠶⠀⠼⠙⠲⠑⠐⠦⠼⠁⠚⠔⠣⠐⠤⠼⠉⠜"); } #[test] fn msup_7_5_3() { let expr = "a-2b"; test_braille("UEB", expr, "⠰⠰⠁⠔⠣⠐⠤⠼⠃⠰⠃⠜"); } #[test] fn msup_7_6_2() { let expr = "H+"; test_braille("UEB", expr, "⠠⠓⠰⠔⠐⠖"); } #[test] fn msubsup_7_7_1() { let expr = "x12=y23"; test_braille("UEB", expr, "⠰⠰⠰⠭⠢⠼⠁⠔⠼⠃⠀⠐⠶⠀⠽⠢⠼⠃⠔⠼⠉⠰⠄"); } #[test] fn msubsup_7_7_2() { let expr = "x2k"; test_braille("UEB", expr, "⠭⠰⠔⠼⠃⠢⠅"); } #[test] fn pre_msubsup_7_8_1() { // Note: modified because word indicator is not needed let expr = "U92238"; test_braille("UEB", expr, "⠰⠢⠼⠊⠃⠔⠼⠃⠉⠓⠠⠥"); } #[test] fn pre_sup_7_8_2() { let expr = "2- +3- =5- "; test_braille("UEB", expr, "⠰⠰⠰⠔⠐⠤⠼⠃⠐⠖⠔⠐⠤⠼⠉⠀⠐⠶⠀⠔⠐⠤⠼⠑⠰⠄"); } #[test] fn sum_7_9_1() { let expr = "x=1n xi2"; test_braille("UEB", expr, "⠰⠰⠠⠨⠎⠨⠢⠣⠭⠐⠶⠼⠁⠜⠨⠔⠝⠭⠢⠊⠔⠼⠃"); } #[test] fn lim_7_9_2() { // Note: modified because passage indicator is not needed (same expr when word indicator is used) let expr = "limxa f(x)=1"; test_braille("UEB", expr, "⠰⠰⠇⠊⠍⠨⠢⠣⠭⠳⠕⠁⠜⠋⠐⠣⠭⠐⠜⠀⠐⠶⠀⠼⠁"); } #[test] fn sqrt_8_1_1() { let expr = "9=3"; test_braille("UEB", expr, "⠰⠩⠼⠊⠬⠀⠐⠶⠀⠼⠉"); } #[test] fn sqrt_8_1_2() { let expr = "r= x2+y2"; test_braille("UEB", expr, "⠰⠰⠰⠗⠀⠐⠶⠀⠩⠭⠔⠼⠃⠐⠖⠽⠔⠼⠃⠬⠰⠄"); } #[test] fn sqrt_8_1_3() { let expr = " 783.2×6.547 0.4628 "; test_braille("UEB", expr, "⠰⠰⠩⠷⠼⠛⠓⠉⠲⠃⠐⠦⠼⠋⠲⠑⠙⠛⠨⠌⠼⠚⠲⠙⠋⠃⠓⠾⠬"); } #[test] fn sqrt_8_1_4() { let expr = " x = b± b 2 4ac 2a "; test_braille("UEB", expr, "⠰⠰⠰⠭⠀⠐⠶⠀⠷⠐⠤⠃⠸⠖⠩⠃⠔⠼⠃⠐⠤⠼⠙⠰⠁⠉⠬⠨⠌⠼⠃⠰⠁⠾⠰⠄"); } #[test] fn root_8_2_1() { let expr = "83=2"; test_braille("UEB", expr, "⠰⠰⠩⠔⠼⠉⠼⠓⠬⠀⠐⠶⠀⠼⠃"); } #[test] fn root_8_2_2() { let expr = "q= x3+ y3+ z3 3"; test_braille("UEB", expr, "⠰⠰⠰⠟⠀⠐⠶⠀⠩⠔⠼⠉⠭⠔⠼⠉⠐⠖⠽⠔⠼⠉⠐⠖⠵⠔⠼⠉⠬⠰⠄"); } #[test] fn root_8_2_3() { let expr = "xymn"; test_braille("UEB", expr, "⠰⠰⠩⠔⠣⠍⠝⠜⠭⠽⠬"); } #[test] fn root_8_2_4() { let expr = " 8134 = (814)3= (81)3= (9)3 = 33 = 27 "; test_braille("UEB", expr, "⠰⠰⠰⠼⠓⠁⠔⠼⠉⠌⠙⠀⠐⠶⠀⠐⠣⠩⠔⠼⠙⠼⠓⠁⠬⠐⠜⠔⠼⠉⠀⠐⠶⠀⠐⠣⠩⠩⠼⠓⠁⠬⠬⠐⠜⠔⠼⠉⠀⠐⠶⠀⠐⠣⠩⠼⠊⠬⠐⠜⠔⠼⠉⠀⠐⠶⠀⠼⠉⠔⠼⠉⠀⠐⠶⠀⠼⠃⠛⠰⠄"); } #[test] fn root_letter_base() { // none of the guides cover this case, but it seems that an a-j base needs a grade 1 indicator let expr = "b3x3"; test_braille("UEB", expr, "⠰⠰⠩⠔⠼⠉⠰⠃⠬⠩⠔⠼⠉⠭⠬"); } #[test] fn spacing_9_3_1_1() { let expr = " Sin 30 "; test_braille("UEB", expr, "⠠⠎⠔⠼⠉⠚"); } #[test] fn spacing_9_3_1_2() { let expr = "3tan45°"; test_braille("UEB", expr, "⠼⠉⠞⠁⠝⠼⠙⠑⠘⠚"); } #[test] fn spacing_9_3_1_3() { let expr = "4cos5x"; test_braille("UEB", expr, "⠼⠙⠰⠉⠕⠎⠼⠑⠭"); } #[test] fn spacing_9_3_2_1() { let expr = "logy"; test_braille("UEB", expr, "⠇⠕⠛⠀⠰⠽"); } #[test] fn spacing_9_3_2_2() { let expr = "sinθ"; test_braille("UEB", expr, "⠎⠔⠨⠹"); } #[test] fn spacing_9_3_2_3() { let expr = "SecA"; test_braille("UEB", expr, "⠠⠎⠑⠉⠠⠁"); } #[test] fn spacing_9_3_2_4() { let expr = "log(x+y)"; test_braille("UEB", expr, "⠇⠕⠛⠐⠣⠭⠐⠖⠽⠐⠜"); } #[test] fn spacing_9_3_2_5() { let expr = "Limx2"; test_braille("UEB", expr, "⠰⠰⠠⠇⠊⠍⠷⠭⠨⠌⠼⠃⠾"); } #[test] fn spacing_9_3_3_1() { let expr = "xsin60"; test_braille("UEB", expr, "⠰⠭⠀⠎⠔⠼⠋⠚"); } #[test] fn spacing_9_3_3_2() { let expr = "xSin60"; test_braille("UEB", expr, "⠭⠠⠎⠔⠼⠋⠚"); } #[test] fn spacing_9_3_3_3() { let expr = "Xlogy"; test_braille("UEB", expr, "⠰⠠⠭⠀⠇⠕⠛⠀⠰⠽"); } #[test] fn spacing_9_3_3_4() { let expr = "xLogy"; test_braille("UEB", expr, "⠭⠠⠇⠕⠛⠀⠰⠽"); } #[test] fn spacing_9_3_3_5() { let expr = " sin(A+B) =sinAcos B +cosAsinB"; test_braille("UEB", expr, "⠎⠔⠐⠣⠠⠁⠐⠖⠠⠃⠐⠜⠀⠐⠶⠀⠎⠔⠠⠁⠀⠉⠕⠎⠠⠃⠐⠖⠉⠕⠎⠠⠁⠀⠎⠔⠠⠃"); } #[test] fn spacing_9_3_3_6() { let expr = "sin2β= 2sinβcosβ"; test_braille("UEB", expr, "⠎⠔⠼⠃⠨⠃⠀⠐⠶⠀⠼⠃⠎⠊⠝⠨⠃⠉⠕⠎⠨⠃"); } #[test] fn text_9_7_1_mtext() { let expr = "Pr(A and B)= PrA+PrB"; test_braille("UEB", expr, "⠠⠏⠗⠐⠣⠠⠁⠀⠯⠀⠰⠠⠃⠐⠜⠀⠐⠶⠀⠠⠏⠗⠠⠁⠐⠖⠠⠏⠗⠠⠃"); } #[test] fn text_9_7_1() { // ugly as the MathML is with non-breaking space in mo's, this is a WIRIS editor output let expr = "Pr(A and B)= PrA+PrB"; test_braille("UEB", expr, "⠠⠏⠗⠐⠣⠠⠁⠀⠯⠀⠰⠠⠃⠐⠜⠀⠐⠶⠀⠠⠏⠗⠠⠁⠐⠖⠠⠏⠗⠠⠃"); } #[test] fn stat_9_7_2() { let expr = "Exp(R)= n2+1"; // GTM uses "⠰⠰⠰⠠⠑⠭⠏⠐⠣⠠⠗⠐⠜⠀⠐⠶⠀⠷⠝⠨⠌⠼⠃⠾⠐⠖⠼⠁⠰⠄", // but "⠠⠑⠭⠏⠐⠣⠠⠗⠐⠜⠀⠐⠶⠀⠰⠰⠷⠝⠨⠌⠼⠃⠾⠐⠖⠼⠁" is shorter and is consistent with omission_3_6_7 and fraction_6_4_6 test_braille("UEB", expr, "⠠⠑⠭⠏⠐⠣⠠⠗⠐⠜⠀⠐⠶⠀⠰⠰⠷⠝⠨⠌⠼⠃⠾⠐⠖⠼⠁"); } #[test] fn set_10_1() { let expr = "A= 1,2,3,4 "; test_braille("UEB", expr, "⠠⠁⠀⠐⠶⠀⠸⠣⠼⠁⠂⠀⠼⠃⠂⠀⠼⠉⠂⠀⠼⠙⠸⠜"); } #[test] fn set_10_3() { let expr = "3AB"; test_braille("UEB", expr, "⠼⠉⠀⠘⠑⠀⠠⠁⠨⠦⠠⠃"); } #[test] fn set_10_4() { let expr = "ABAB"; test_braille("UEB", expr, "⠠⠁⠨⠦⠠⠃⠀⠘⠣⠀⠠⠁⠨⠖⠠⠃"); } #[test] fn set_10_5() { let expr = "A'B'= (AB)'"; test_braille("UEB", expr, "⠰⠰⠰⠠⠁⠶⠨⠖⠠⠃⠶⠀⠐⠶⠀⠐⠣⠠⠁⠨⠦⠠⠃⠐⠜⠶⠰⠄"); } #[test] fn set_10_6() { // Note: example uses the wrong char "├" in the display -- should be "⊢" let expr = "[(pq)¬p] q"; // Acceptable: GTM does uses a G1 passage indicator: "⠰⠰⠰⠨⠣⠐⠣⠏⠈⠖⠟⠐⠜⠈⠦⠈⠹⠏⠨⠜⠀⠸⠒⠀⠟⠰⠄" // However, the BANA G1 standing alone rule ("...before a single letter standing alone") applies, so start in G2 mode. // Corrected to remove the passage indicator test_braille("UEB", expr, "⠨⠣⠐⠣⠏⠈⠖⠟⠐⠜⠈⠦⠈⠹⠏⠨⠜⠀⠸⠒⠀⠰⠟"); } #[test] fn example_11_5_1_2() { let expr = "dydx"; test_braille("UEB", expr, "⠰⠰⠷⠙⠽⠨⠌⠙⠭⠾"); } #[test] fn example_11_5_1_3() { let expr = "f'(x)"; // Acceptable: GTM uses a G1 start indicator: "⠰⠰⠋⠶⠐⠣⠭⠐⠜" // However, BANA says don't use a word indicator if G1 is in first 3 cells (the ':' needs it) // Corrected to avoid word indicator test_braille("UEB", expr, "⠋⠰⠶⠐⠣⠭⠐⠜"); } #[test] fn example_11_5_1_4() { let expr = "yx"; test_braille("UEB", expr, "⠰⠰⠷⠈⠙⠽⠨⠌⠈⠙⠭⠾"); } #[test] fn example_11_5_2() { let expr = "23(2x+1)dx =x2+x23 =(32+3)-(22+2) =12-6=6"; test_braille("UEB", expr, "⠰⠰⠰⠮⠢⠼⠃⠔⠼⠉⠐⠣⠼⠃⠭⠐⠖⠼⠁⠐⠜⠙⠭⠀⠐⠶⠀⠨⠣⠭⠔⠼⠃⠐⠖⠭⠨⠜⠢⠼⠃⠔⠼⠉⠀⠐⠶⠀⠐⠣⠼⠉⠔⠼⠃⠐⠖⠼⠉⠐⠜⠐⠤⠐⠣⠼⠃⠔⠼⠃⠐⠖⠼⠃⠐⠜⠀⠐⠶⠀⠼⠁⠃⠐⠤⠼⠋⠀⠐⠶⠀⠼⠋⠰⠄"); } #[test] fn example_11_5_3() { // from MathJaX let expr = " n Cr = ( nr ) = n! r!(nr)! "; // modified to use "shape" as recommended in a comment on this example test_braille("UEB", expr, "⠰⠰⠰⠔⠝⠠⠉⠢⠗⠀⠐⠶⠀⠐⠣⠝⠰⠻⠗⠐⠜⠀⠐⠶⠀⠷⠝⠖⠨⠌⠗⠖⠐⠣⠝⠐⠤⠗⠐⠜⠖⠾⠰⠄"); } #[test] fn example_11_5_4() { let expr = "a(bc) =(ab)(ac)"; test_braille("UEB", expr, "⠁⠐⠔⠐⠣⠃⠐⠴⠉⠐⠜⠀⠐⠶⠀⠐⠣⠁⠐⠔⠃⠐⠜⠐⠴⠐⠣⠁⠐⠔⠉⠐⠜"); } #[test] fn example_11_5_5_2() { let expr = " f 1 : Y X "; test_braille("UEB", expr, "⠰⠰⠰⠋⠔⠣⠐⠤⠼⠁⠜⠒⠀⠠⠽⠀⠳⠕⠀⠠⠭⠰⠄"); } #[test] fn example_11_5_5_3() { // this comes from MathJax let expr = " y Y x X "; test_braille("UEB", expr, "⠰⠰⠰⠘⠁⠽⠀⠘⠑⠀⠠⠽⠀⠘⠢⠭⠀⠘⠑⠀⠠⠭⠰⠄"); } #[test] fn example_11_5_6() { let expr = " { ( x , y ) | x + y = 6 } "; test_braille("UEB", expr, "⠰⠰⠰⠸⠣⠐⠣⠭⠂⠀⠽⠐⠜⠀⠸⠳⠀⠭⠐⠖⠽⠀⠐⠶⠀⠼⠋⠸⠜⠰⠄"); } #[test] fn example_11_6_math_variant() { let expr = "R"; test_braille("UEB", expr, "⠈⠆⠰⠠⠗"); } #[test] fn example_11_6() { let expr = ""; test_braille("UEB", expr, "⠈⠆⠰⠠⠗"); } #[test] fn bar_over_12_1_1() { let expr = "x_= 10+11+123"; test_braille("UEB", expr, "⠰⠰⠰⠭⠱⠀⠐⠶⠀⠷⠼⠁⠚⠐⠖⠼⠁⠁⠐⠖⠼⠁⠃⠨⠌⠼⠉⠾⠰⠄"); } #[test] fn bar_under_12_1_2() { let expr = "x+y_"; test_braille("UEB", expr, "⠰⠰⠣⠭⠐⠖⠽⠜⠠⠱"); } #[test] fn bar_menclose_12_1_2() { let expr = "x+y"; test_braille("UEB", expr, "⠰⠰⠣⠭⠐⠖⠽⠜⠠⠱"); } #[test] fn dot_12_1_4() { let expr = "0.3."; test_braille("UEB", expr, "⠼⠚⠲⠣⠼⠉⠜⠘⠲"); } #[test] fn dot_12_1_5() { let expr = "0.561˙ 23˙"; test_braille("UEB", expr, "⠼⠚⠲⠑⠋⠣⠼⠁⠜⠘⠲⠼⠃⠣⠼⠉⠜⠘⠲"); } #[test] fn dot_12_1_6_single() { let expr = "x˙"; test_braille("UEB", expr, "⠭⠘⠲"); } #[test] fn dot_12_1_6_double() { let expr = "x¨"; test_braille("UEB", expr, "⠰⠰⠭⠨⠔⠣⠲⠲⠜"); } #[test] fn hat_12_1_7() { let expr = "AB^C"; // Acceptable: GTM uses a G1 start indicator: "⠰⠰⠠⠁⠠⠃⠐⠱⠠⠉" // BANA says use a word indicator if G1 not in first 3 cells (modified it to not count cap indicators since that helps with GTM compatibility) // Corrected to skip the G1 indicator at the start (it's debatable as to which is better) test_braille("UEB", expr, "⠠⠁⠠⠃⠰⠐⠱⠠⠉"); } #[test] fn arrow_over_12() { // This comes from https://uebonline.org/wp-content/uploads/2021/05/Unified-English-Braille-Extension-Maths-Training-Manual-First-Edition-Rev-4.pdf let expr = "x"; test_braille("UEB", expr, "⠭⠰⠘⠱"); } #[test] fn arrow_under_12() { // This comes from https://uebonline.org/wp-content/uploads/2021/05/Unified-English-Braille-Extension-Maths-Training-Manual-First-Edition-Rev-4.pdf let expr = "x"; test_braille("UEB", expr, "⠭⠰⠠⠘⠱"); } #[test] fn bar_12_2_1() { let expr = "xy¯"; test_braille("UEB", expr, "⠰⠰⠭⠔⠣⠽⠱⠜"); } #[test] fn bar_12_2_2() { let expr = "xy¯"; test_braille("UEB", expr, "⠰⠰⠣⠭⠔⠽⠜⠱"); } #[test] fn shape_14_1_1_1() { let expr = " ABC"; test_braille("UEB", expr, "⠰⠫⠼⠉⠀⠠⠠⠁⠃⠉"); } #[test] fn shape_14_1_2_1() { let expr = "ABC"; test_braille("UEB", expr, "⠰⠫⠼⠉⠱⠠⠠⠁⠃⠉"); } #[test] fn shape_14_1_2_2() { // the for the shapes are wrong -- but it isn't clear what they should be (from WIRIS editor) let expr = "{,  ,  ,   }"; test_braille("UEB", expr, "⠸⠣⠰⠫⠼⠙⠱⠂⠀⠨⠫⠿⠱⠂⠀⠸⠫⠼⠉⠱⠂⠀⠨⠫⠼⠙⠀⠲⠲⠲⠸⠜"); } #[test] fn binomial_14_3_3_2() { let expr = "nr"; test_braille("UEB", expr, "⠐⠣⠝⠰⠻⠗⠐⠜"); } #[test] fn binomial_14_3_3_2_mtable() { let expr = " ( n r ) "; test_braille("UEB", expr, "⠐⠣⠝⠰⠻⠗⠐⠜"); } #[test] fn chem_16_2_8() { let expr = "Ca(OH)2"; // Acceptable: GTM does not use a G1 start indicator: "⠠⠉⠁⠐⠣⠠⠕⠠⠓⠐⠜⠰⠢⠼⠃" // However, BANA says use a word indicator if G1 not in first 3 cells (it is before the subscript near the end); use passage if >=2 whitespace // This seems like a debateable choice in this case since there is only one G1 indicator, but that's the BANA guidance so... // Corrected to use word indicator test_braille("UEB", expr, "⠰⠰⠠⠉⠁⠐⠣⠠⠕⠠⠓⠐⠜⠢⠼⠃"); } #[test] fn chem_16_2_9() { // from mhchem -- \ce{CuSO4·5H2O} let expr = " CuSO A 4 5 H A 2 O "; // Acceptable: GTM does not use a G1 start indicator: "⠠⠉⠥⠠⠎⠠⠕⠰⠢⠼⠙⠐⠲⠼⠑⠠⠓⠢⠼⠃⠠⠕" // However, BANA says use a word indicator if G1 not in first 3 cells (it is before the subscript); use passage if >=2 whitespace // This seems like a debatable choice in this case since there is only one G1 indicator, but that's the BANA guidance so... // Corrected to use word indicator test_braille("UEB", expr, "⠰⠰⠠⠉⠥⠠⠎⠠⠕⠢⠼⠙⠐⠲⠼⠑⠠⠓⠢⠼⠃⠠⠕"); } #[test] fn chem_16_2_10() { let expr = "H+"; test_braille("UEB", expr, "⠠⠓⠰⠔⠐⠖"); } #[test] fn chem_16_2_11() { let expr = " S O 4 -- "; test_braille("UEB", expr, "⠠⠎⠠⠕⠰⠢⠼⠙⠔⠣⠐⠤⠐⠤⠜"); } #[test] fn chem_16_2_12() { // from MathJax/mhchem V3 let expr = " R CH ( OH ) CH A 2 CH A 2 CO A 2 H "; // GTM uses G2 mode and has two G1 indicators (in middle and near end). That definitely violates BANA guidelines and maybe there guidelines. // I have switched it to G1 word mode, which seems better (same length, but no switching) test_braille("UEB", expr, "⠰⠰⠠⠠⠠⠗⠐⠲⠉⠓⠐⠣⠕⠓⠐⠜⠐⠲⠉⠓⠢⠼⠃⠐⠲⠉⠓⠢⠼⠃⠐⠲⠉⠕⠢⠼⠃⠰⠓⠠⠄"); } #[test] fn chem_16_2_13() { let expr = " FeIII Cl3 "; test_braille("UEB", expr, "⠰⠰⠠⠋⠑⠔⠣⠠⠠⠊⠊⠊⠜⠠⠉⠇⠢⠼⠉"); } #[test] fn chem_16_3_1() { // see also pre_msubsup_7_8_1 which uses mmultiscripts // from MathJax let expr = "92238U"; test_braille("UEB", expr, "⠰⠢⠼⠊⠃⠔⠼⠃⠉⠓⠠⠥"); } #[test] fn chem_16_4_2() { // from MathJax let expr = r#"1S0"#; test_braille("UEB", expr, "⠰⠔⠼⠁⠠⠎⠢⠼⠚"); } #[test] fn chem_16_4_3() { // from MathJax using \mathrm{} let expr = r#" 4d9 5s2 2 D5/2 "#; test_braille("UEB", expr, "⠼⠙⠰⠙⠔⠼⠊⠼⠑⠎⠔⠼⠃⠀⠰⠔⠼⠃⠠⠙⠢⠣⠼⠑⠸⠌⠼⠃⠜"); } #[test] fn chem_16_5_1() { // from MathJax v3 mhchem, but substituted short arrow because that is what example uses (although it shouldn't) let expr = r#" 2 NaOH + H A 2 SO A 4 Na A 2 SO A 4 + 2 H A 2 O "#; test_braille("UEB", expr, "⠰⠰⠰⠼⠃⠠⠝⠁⠠⠕⠠⠓⠐⠖⠠⠓⠢⠼⠃⠠⠎⠠⠕⠢⠼⠙⠀⠳⠕⠀⠠⠝⠁⠢⠼⠃⠠⠎⠠⠕⠢⠼⠙⠐⠖⠼⠃⠠⠓⠢⠼⠃⠠⠕⠰⠄"); } #[test] fn chem_16_5_2() { // from WIRIS let expr = r#" N2 Haber processH2 N H3 "#; // GTM has the order be over followed by under. This is opposite of what is shown in 7.9 (which are large op examples). // I have spoken with several people about this, including ICEB committee members who all feel this example is a mistake. // I have adjusted the expected output test_braille("UEB", expr, "⠰⠰⠰⠠⠝⠢⠼⠃⠀⠳⠕⠨⠢⠣⠠⠓⠁⠃⠑⠗⠀⠏⠗⠕⠉⠑⠎⠎⠜⠨⠔⠣⠠⠓⠢⠼⠃⠜⠀⠠⠝⠠⠓⠢⠼⠉⠰⠄"); } #[test] fn chem_16_5_3() { // from MathJax v3 mhchem, uses "\;" before parens because example adds a space there (although it shouldn't) let expr = r#" H A 2 ( g ) + I A 2 ( s ) = 2 HI ( g ) "#; test_braille("UEB", expr, "⠰⠰⠰⠠⠓⠢⠼⠃⠀⠐⠣⠛⠐⠜⠐⠖⠠⠊⠢⠼⠃⠀⠐⠣⠎⠐⠜⠀⠐⠶⠀⠼⠃⠠⠓⠠⠊⠀⠐⠣⠛⠐⠜⠰⠄"); } #[test] fn chem_16_5_4() { // from MathJax v4 mhchem, but substituted short arrow because that is what example uses (although it shouldn't) let expr = r#" HNCO + ROH NH A 2 CO OR NH A 2 CO NH CO A 2 R "#; test_braille("UEB", expr, "⠰⠰⠰⠠⠠⠠⠓⠝⠉⠕⠐⠖⠗⠕⠓⠀⠳⠕⠀⠝⠓⠢⠼⠃⠐⠲⠉⠕⠐⠲⠕⠗⠀⠳⠕⠀⠝⠓⠢⠼⠃⠰⠉⠕⠐⠲⠝⠓⠐⠲⠉⠕⠢⠼⠃⠗⠠⠄⠰⠄"); } #[test] fn chem_16_5_5() { // from MathJax v3 mhchem let expr = r#" Pb A++ + 2 e Pb "#; test_braille("UEB", expr, "⠰⠰⠰⠠⠏⠃⠔⠣⠐⠖⠐⠖⠜⠐⠖⠼⠃⠰⠑⠀⠘⠸⠶⠀⠠⠏⠃⠰⠄"); }