// Swedish braille tests for the basic mathml tags // These tests are from the Swedish braille authority's publication "Punktskriftens skrivregeler för matematik och naturvetenskap" // https://www.mtm.se/globalassets/punktskriftsnamnden/punktskriftens_skrivregler_matematik.pdf use crate::common::*; #[test] fn ex_1_4() { let expr= r#"a>ob"#; test_braille("Swedish", expr, "⠁⠀⠼⠕⠀⠕⠀⠼⠕⠕⠀⠃"); } // CHAPTER 5 #[test] fn ex_5_1() { let expr= r#"5+12"#; test_braille("Swedish", expr, "⠼⠑⠀⠲⠀⠼⠁⠃"); } #[test] fn ex_5_2() { let expr= r#"9,99+0,001"#; test_braille("Swedish", expr, "⠼⠊⠂⠊⠊⠀⠲⠀⠼⠚⠂⠚⠚⠁"); } #[test] fn ex_5_3() { let expr= r#"1/2+1/2"#; test_braille("Swedish", expr, "⠼⠁⠌⠼⠃⠀⠲⠀⠼⠁⠌⠼⠃"); } #[test] fn ex_5_4() { let expr= r#"y=5+x"#; test_braille("Swedish", expr, "⠽⠀⠶⠀⠼⠑⠀⠲⠀⠭"); } #[test] fn ex_5_5() { let expr= r#"613221"#; test_braille("Swedish", expr, "⠼⠋⠁⠉⠀⠤⠀⠼⠃⠃⠁"); } #[test] fn ex_5_6() { let expr= r#"10,13,05"#; test_braille("Swedish", expr, "⠼⠁⠚⠂⠁⠀⠤⠀⠼⠉⠂⠚⠑"); } #[test] fn ex_5_7() { let expr= r#"314134"#; test_braille("Swedish", expr, "⠼⠉⠼⠁⠳⠼⠙⠀⠤⠀⠼⠁⠼⠉⠳⠼⠙"); } #[test] fn ex_5_8() { let expr= r#"0,5+3,4+67,50,02"#; test_braille("Swedish", expr, "⠼⠚⠂⠑⠀⠲⠀⠼⠉⠂⠙⠀⠲⠀⠼⠋⠀⠤⠀⠼⠛⠂⠑⠀⠤⠀⠼⠚⠂⠚⠃"); } #[test] fn ex_5_9() { let expr= r#"α±2π"#; test_braille("Swedish", expr, "⠰⠁⠀⠨⠲⠤⠀⠼⠃⠰⠏"); } #[test] fn ex_5_10() { let expr= r#"1513"#; test_braille("Swedish", expr, "⠼⠁⠑⠀⠻⠄⠀⠼⠁⠉"); } #[test] fn ex_5_11() { let expr= r#"4.51.4"#; test_braille("Swedish", expr, "⠼⠙⠄⠑⠀⠻⠄⠀⠼⠁⠄⠙"); } #[test] fn ex_5_12() { let expr= r#"2ab2ab2ab"#; test_braille("Swedish", expr, "⠼⠃⠱⠁⠃⠀⠻⠄⠀⠼⠃⠱⠁⠃⠀⠻⠄⠀⠼⠃⠱⠁⠃"); } #[test] fn ex_5_13() { let expr= r#"rn=sn"#; // FIXED: added spaces around · because that is in the TeX list of binary ops -- it is also that way in the spec test_braille("Swedish", expr, "⠨⠗⠀⠨⠻⠄⠀⠨⠝⠀⠶⠀⠨⠎⠀⠨⠻⠄⠀⠨⠝"); } #[test] fn ex_5_14() { let expr= r#"LET C=A*B"#; test_braille("Swedish", expr, "⠠⠠⠇⠑⠞⠀⠠⠉⠀⠶⠀⠠⠁⠔⠠⠃"); } #[test] fn ex_5_15() { let expr= r#"24×36"#; test_braille("Swedish", expr, "⠼⠃⠙⠀⠻⠭⠀⠼⠉⠋"); } #[test] fn ex_5_16() { let expr= r#"2317"#; test_braille("Swedish", expr, "⠼⠃⠉⠁⠳⠼⠛"); } #[test] fn ex_5_17() { let expr= r#"0,640,08"#; test_braille("Swedish", expr, "⠼⠚⠂⠋⠙⠳⠼⠚⠂⠚⠓"); } #[test] fn ex_5_18() { let expr= r#"0,2/0,004"#; test_braille("Swedish", expr, "⠼⠚⠂⠃⠌⠼⠚⠂⠚⠚⠙"); } #[test] fn ex_5_19() { let expr= r#"Ritningen var i skala 1:100"#; test_braille("Swedish", expr, "⠠⠗⠊⠞⠝⠊⠝⠛⠑⠝⠀⠧⠁⠗⠀⠊⠀⠎⠅⠁⠇⠁⠀⠼⠁⠒⠼⠁⠚⠚"); } // CHAPTER 6 #[test] fn ex_6_1() { let expr= r#"x2=9"#; test_braille("Swedish", expr, "⠭⠳⠼⠃⠀⠶⠀⠼⠊"); } #[test] fn ex_6_2() { let expr= r#"5/5=1"#; test_braille("Swedish", expr, "⠼⠑⠌⠼⠑⠀⠶⠀⠼⠁"); } #[test] fn ex_6_3() { let expr= r#"34+13= 912+412 =1312"#; test_braille("Swedish", expr, "⠼⠉⠳⠼⠙⠀⠲⠀⠼⠁⠳⠼⠉⠀⠶⠀⠼⠊⠳⠼⠁⠃⠀⠲⠀⠼⠙⠳⠼⠁⠃⠀⠶⠀⠼⠁⠉⠳⠼⠁⠃"); } #[test] fn ex_6_4() { let expr= r#"(x+1) (x1)"#; test_braille("Swedish", expr, "⠦⠭⠲⠼⠁⠴⠳⠦⠭⠤⠼⠁⠴"); } #[test] fn ex_6_5() { let expr= r#"x+1 x1"#; test_braille("Swedish", expr, "⠿⠦⠭⠲⠼⠁⠳⠭⠤⠼⠁⠿⠴"); } #[test] fn ex_6_6() { let expr= r#"2ab= 2ab"#; // FIXED: the example made both fractions have start/end indicators, but the first one doesn't need them and so they were removed from the output test_braille("Swedish", expr, "⠼⠃⠱⠁⠳⠃⠀⠶⠀⠿⠦⠼⠃⠱⠁⠳⠃⠿⠴"); } #[test] fn ex_6_7() { let expr= r#"lgx10 =0,1lgx"#; // FIXED: removed space before "lg" as that is not *required* in braille test_braille("Swedish", expr, "⠿⠦⠇⠛⠀⠭⠳⠼⠁⠚⠿⠴⠀⠶⠀⠼⠚⠂⠁⠇⠛⠀⠭"); } #[test] fn ex_6_8() { let expr= r#"lgx10 =lgx1"#; test_braille("Swedish", expr, "⠇⠛⠿⠦⠭⠳⠼⠁⠚⠿⠴⠀⠶⠀⠇⠛⠀⠭⠀⠤⠀⠼⠁"); } #[test] fn ex_6_9() { let expr= r#"314134 =254134 =124=112 "#; test_braille("Swedish", expr, "⠼⠉⠼⠁⠳⠼⠙⠀⠤⠀⠼⠁⠼⠉⠳⠼⠙⠀⠶⠀⠼⠃⠼⠑⠳⠼⠙⠀⠤⠀⠼⠁⠼⠉⠳⠼⠙⠀⠶⠀⠼⠁⠼⠃⠳⠼⠙⠀⠶⠀⠼⠁⠼⠁⠳⠼⠃"); } #[test] fn ex_6_10() { let expr= r#"31/413/4 =25/413/4 =12/4=11/2 "#; test_braille("Swedish", expr, "⠼⠉⠀⠼⠁⠌⠼⠙⠀⠤⠀⠼⠁⠀⠼⠉⠌⠼⠙⠀⠶⠀⠼⠃⠀⠼⠑⠌⠼⠙⠀⠤⠀⠼⠁⠀⠼⠉⠌⠼⠙⠀⠶⠀⠼⠁⠀⠼⠃⠌⠼⠙⠀⠶⠀⠼⠁⠀⠼⠁⠌⠼⠃"); } #[test] fn ex_6_11() { let expr= r#"1372"#; // FIXED: removed spacing around ⋅ (dot multiply) in numerator test_braille("Swedish", expr, "⠿⠦⠼⠁⠉⠻⠄⠼⠛⠳⠼⠃⠿⠴"); } #[test] fn ex_6_12() { let expr= r#"55+(18)2 (63)(3)( 7)"#; // FIXED: removed spacing around ⋅ (dot multiply) in numerator [adding space here makes no sense because if anything "-" should have space] // FIXED: removed spacing around fraction line sign (⠳) test_braille("Swedish", expr, "⠿⠦⠼⠑⠑⠲⠦⠤⠼⠁⠓⠴⠻⠄⠼⠃⠤⠦⠤⠼⠋⠉⠴⠳⠦⠤⠼⠉⠴⠤⠦⠤⠼⠛⠴⠿⠴"); } #[test] fn ex_6_13() { let expr= r#"n(n1)(n k+1)k!"#; test_braille("Swedish", expr, "⠿⠦⠝⠦⠝⠤⠼⠁⠴⠀⠄⠄⠄⠀⠦⠝⠤⠅⠲⠼⠁⠴⠳⠅⠖⠿⠴"); } #[test] fn ex_6_14() { let expr= r#"P(A)=Number of outcomes in A Total number of outcomes"#; // FIXED: removed spaces around fraction line (⠳) test_braille("Swedish", expr, "⠠⠏⠦⠠⠁⠴⠀⠶⠀⠿⠦⠠⠝⠥⠍⠃⠑⠗⠀⠕⠋⠀⠕⠥⠞⠉⠕⠍⠑⠎⠀⠊⠝⠀⠠⠁⠳⠠⠞⠕⠞⠁⠇⠀⠝⠥⠍⠃⠑⠗⠀⠕⠋⠀⠕⠥⠞⠉⠕⠍⠑⠎⠿⠴"); } #[test] fn ex_6_15() { let expr= r#"b0+a1 b1+a2 b2++an bn"#; // FIXED: removed spacing around "+"s in continued fraction (left spaces in around ellipsis) test_braille("Swedish", expr, "⠃⠣⠼⠚⠀⠲⠀⠿⠦⠁⠣⠼⠁⠳⠃⠣⠼⠁⠲⠿⠦⠁⠣⠼⠃⠳⠃⠣⠼⠃⠲⠀⠄⠄⠄⠀⠲⠁⠣⠝⠳⠃⠣⠝⠿⠴⠿⠴"); } #[test] fn ex_6_16() { let expr= r#"z=7x6y 5x+8y7x6y 8y+5x"#; // FIXED: removed spacing around complex fraction line sign (⠳⠳) test_braille("Swedish", expr, "⠵⠀⠶⠀⠿⠦⠼⠛⠭⠤⠼⠋⠽⠳⠼⠑⠭⠲⠼⠓⠽⠿⠴⠳⠳⠿⠦⠼⠛⠭⠤⠼⠋⠽⠳⠼⠓⠽⠲⠼⠑⠭⠿⠴"); } #[test] fn ex_6_17() { let expr= r#"z=1+7x6y 5x+8y7x6y 8y+5x"#; // FIXED: removed spacing around complex fraction line sign (⠳⠳) test_braille("Swedish", expr, "⠵⠀⠶⠀⠿⠦⠼⠁⠲⠿⠦⠼⠛⠭⠤⠼⠋⠽⠳⠼⠑⠭⠲⠼⠓⠽⠿⠴⠳⠳⠿⠦⠼⠛⠭⠤⠼⠋⠽⠳⠼⠓⠽⠲⠼⠑⠭⠿⠴⠿⠴"); } #[test] fn ex_6_18() { let expr= r#"x+y6x/ x+y2x=13 "#; // FIXED: removed spacing around complex fraction line sign (⠌⠌) test_braille("Swedish", expr, "⠿⠦⠭⠲⠽⠳⠼⠋⠭⠿⠴⠌⠌⠿⠦⠭⠲⠽⠳⠼⠃⠭⠿⠴⠀⠶⠀⠼⠁⠳⠼⠉"); } #[test] fn ex_6_19() { // FIXED: Added non-breaking spaces around the text let expr= r#"963,96 /3 och 9/63  betecknar talet 1,53"#; // FIXED: removed spacing around complex fraction line signs (⠳⠳ and ⠌⠌) test_braille("Swedish", expr, "⠿⠦⠼⠊⠳⠼⠋⠳⠳⠼⠉⠿⠴⠂⠀⠿⠦⠼⠊⠳⠼⠋⠌⠌⠼⠉⠿⠴⠀⠕⠉⠓⠀⠿⠦⠼⠊⠌⠼⠋⠳⠳⠼⠉⠿⠴⠀⠃⠑⠞⠑⠉⠅⠝⠁⠗⠀⠞⠁⠇⠑⠞⠀⠼⠁⠂⠑⠳⠼⠉"); } #[test] fn ex_6_20() { let expr= r#"a+bab= tanα+β2 tanαβ2"#; // FIXED: removed spacing around complex fraction line sign (⠳⠳) test_braille("Swedish", expr, "⠿⠦⠁⠲⠃⠳⠁⠤⠃⠿⠴⠀⠶⠀⠿⠦⠞⠁⠝⠿⠦⠰⠁⠲⠰⠃⠳⠼⠃⠿⠴⠳⠳⠞⠁⠝⠿⠦⠰⠁⠤⠰⠃⠳⠼⠃⠿⠴⠿⠴"); } #[test] fn ex_6_21() { // FIXED: added 'intent' to disambiguate let expr= r#"(nk) =n!(nk)!k! "#; test_braille("Swedish", expr, "⠦⠝⠘⠳⠅⠴⠀⠶⠀⠿⠦⠝⠖⠳⠦⠝⠤⠅⠴⠖⠅⠖⠿⠴"); } #[test] fn ex_6_21_mfrac() { let expr= r#"(nk) =n!(nk)!k! "#; test_braille("Swedish", expr, "⠦⠝⠘⠳⠅⠴⠀⠶⠀⠿⠦⠝⠖⠳⠦⠝⠤⠅⠴⠖⠅⠖⠿⠴"); } // CHAPTER 7 #[test] fn ex_7_1() { let expr= r#"(25)3=2 15"#; test_braille("Swedish", expr, "⠦⠼⠃⠬⠼⠑⠴⠬⠼⠉⠀⠶⠀⠼⠃⠬⠼⠁⠑"); } #[test] fn ex_7_2() { let expr= r#"x2yx3y2"#; test_braille("Swedish", expr, "⠭⠬⠼⠃⠽⠀⠻⠄⠀⠭⠬⠼⠉⠽⠬⠼⠃"); } #[test] fn ex_7_3() { let expr= r#"f(2m1)"#; test_braille("Swedish", expr, "⠋⠬⠦⠼⠃⠍⠤⠼⠁⠴"); } #[test] fn ex_7_4() { let expr= r#"1012"#; test_braille("Swedish", expr, "⠼⠁⠚⠬⠤⠼⠁⠃"); } #[test] fn ex_7_5() { let expr= r#"zn=(reiθ )n=rneinθ "#; test_braille("Swedish", expr, "⠵⠬⠝⠀⠶⠀⠦⠗⠑⠘⠬⠊⠰⠓⠱⠴⠬⠝⠀⠶⠀⠗⠬⠝⠑⠘⠬⠊⠝⠰⠓⠱"); } #[test] fn ex_7_6() { let expr= r#"e(π2+2nπ )+iln2"#; test_braille("Swedish", expr, "⠑⠘⠬⠤⠦⠰⠏⠳⠼⠃⠲⠼⠃⠝⠰⠏⠴⠲⠊⠇⠝⠼⠃⠱"); } #[test] fn ex_7_7() { let expr= r#"22n1"#; test_braille("Swedish", expr, "⠼⠃⠬⠼⠃⠘⠬⠝⠤⠼⠁⠱"); } #[test] fn ex_7_8() { let expr= r#"logax+log ay=logax y"#; test_braille("Swedish", expr, "⠬⠁⠇⠕⠛⠀⠭⠀⠲⠀⠬⠁⠇⠕⠛⠀⠽⠀⠶⠀⠬⠁⠇⠕⠛⠀⠭⠽"); } #[test] fn ex_7_9() { let expr= r#"ex2/4a y2/4bz2/4c "#; test_braille("Swedish", expr, "⠑⠘⠬⠤⠭⠬⠼⠃⠌⠼⠙⠱⠁⠤⠽⠬⠼⠃⠌⠼⠙⠱⠃⠤⠵⠬⠼⠃⠌⠼⠙⠱⠉⠱"); } #[test] fn ex_7_10() { let expr= r#"x1,x2,,x m1"#; test_braille("Swedish", expr, "⠭⠣⠼⠁⠂⠀⠭⠣⠼⠃⠂⠀⠄⠄⠄⠂⠀⠭⠘⠣⠍⠤⠼⠁⠱"); } #[test] fn ex_7_11() { let expr= r#"U92238"#; test_braille("Swedish", expr, "⠣⠼⠊⠃⠬⠼⠃⠉⠓⠠⠥"); } #[test] fn ex_7_12() { let expr= r#"SO42"#; test_braille("Swedish", expr, "⠠⠠⠎⠕⠣⠼⠙⠘⠬⠼⠃⠤⠱"); } #[test] fn ex_7_13() { let expr= r#"H1+11"#; test_braille("Swedish", expr, "⠣⠼⠁⠬⠼⠁⠠⠓⠣⠼⠁⠬⠲"); } #[test] fn ex_7_14() { let expr= r#"limnan  existerar limm n |aman|=0"#; // FIXED: added space around '-' (⠤) test_braille("Swedish", expr, "⠇⠊⠍⠘⠣⠣⠝⠒⠕⠼⠿⠱⠀⠁⠣⠝⠀⠑⠭⠊⠎⠞⠑⠗⠁⠗⠀⠪⠶⠕⠀⠇⠊⠍⠘⠣⠣⠍⠒⠕⠼⠿⠱⠘⠣⠣⠝⠒⠕⠼⠿⠱⠀⠸⠁⠣⠍⠀⠤⠀⠁⠣⠝⠸⠀⠶⠀⠼⠚"); } #[test] fn ex_7_15() { let expr= r#"ab"#; test_braille("Swedish", expr, "⠁⠬⠤⠃"); } #[test] fn ex_7_16() { let expr= r#"ab¯"#; test_braille("Swedish", expr, "⠁⠃⠬⠬⠤"); } #[test] fn ex_7_17() { let expr= r#"y˜=y"#; test_braille("Swedish", expr, "⠽⠬⠬⠒⠀⠶⠀⠽"); } #[test] fn ex_7_18() { let expr= r#"v¯¯ =v_"#; test_braille("Swedish", expr, "⠧⠣⠣⠶⠀⠶⠀⠧⠣⠣⠤"); } #[test] fn ex_7_19() { let expr= r#"σ^2=s2"#; test_braille("Swedish", expr, "⠰⠎⠬⠬⠖⠬⠼⠃⠀⠶⠀⠎⠬⠼⠃"); } #[test] fn ex_7_20() { let expr= r#"ω¯2=KM"#; test_braille("Swedish", expr, "⠰⠺⠬⠬⠤⠬⠼⠃⠀⠶⠀⠠⠅⠳⠠⠍"); } #[test] fn ex_7_21() { let expr= r#"b*a=a*b¯ "#; test_braille("Swedish", expr, "⠃⠔⠁⠀⠶⠀⠘⠁⠔⠃⠱⠬⠬⠤"); } #[test] fn ex_7_22() { let expr= r#"AB"#; test_braille("Swedish", expr, "⠘⠠⠠⠁⠃⠱⠬⠬⠒⠕"); } #[test] fn ex_7_23() { let expr= r#"x+y^=x ^+y^"#; // FIXED: added spaces around "+" (⠲) on the lefthand side of '=' to be consistent test_braille("Swedish", expr, "⠘⠭⠀⠲⠀⠽⠱⠬⠬⠖⠀⠶⠀⠭⠬⠬⠖⠀⠲⠀⠽⠬⠬⠖"); } #[test] fn ex_7_24() { // FIXED: this was changed to match what 7.24 in the spec (both mathml and braille) let expr= r#"x^ˇab 12"#; test_braille("Swedish", expr, "⠣⠼⠁⠬⠼⠃⠭⠣⠣⠶⠬⠬⠖⠣⠁⠬⠃"); } #[test] fn ex_7_24_munderover() { // This uses the "correct" MathML let expr= r#"xˇ^ab 12"#; test_braille("Swedish", expr, "⠣⠼⠁⠬⠼⠃⠭⠣⠣⠶⠬⠬⠖⠣⠁⠬⠃"); } #[test] fn ex_7_25() { let expr= r#"25=5"#; test_braille("Swedish", expr, "⠩⠼⠃⠑⠀⠶⠀⠼⠑"); } #[test] fn ex_7_26() { let expr= r#"1,5"#; test_braille("Swedish", expr, "⠩⠼⠁⠂⠑"); } #[test] fn ex_7_27() { let expr= r#"|5cn|"#; test_braille("Swedish", expr, "⠩⠸⠼⠑⠱⠉⠣⠝⠸"); } #[test] fn ex_7_28() { let expr= r#"a2=(a2 )"#; test_braille("Swedish", expr, "⠘⠩⠁⠳⠼⠃⠱⠀⠶⠀⠩⠦⠁⠳⠼⠃⠴"); } #[test] fn ex_7_29() { let expr= r#"r=a450+225 5"#; // FIXED: removed spaces around fraction line (⠳) test_braille("Swedish", expr, "⠗⠀⠶⠀⠁⠳⠼⠙⠩⠿⠦⠼⠑⠚⠲⠼⠃⠃⠩⠼⠑⠳⠼⠑⠿⠴"); } #[test] fn ex_7_30() { let expr= r#"sa=bc[1( ab+c)2]"#; // FIXED: added space around "+" (⠲) -- it's on the baseline and there is a space around the "-" test_braille("Swedish", expr, "⠎⠣⠁⠀⠶⠀⠘⠩⠃⠉⠷⠼⠁⠀⠤⠀⠦⠁⠳⠃⠀⠲⠀⠉⠴⠬⠼⠃⠾⠱"); } #[test] fn ex_7_31() { let expr= r#"273=3"#; test_braille("Swedish", expr, "⠬⠼⠉⠩⠼⠃⠛⠀⠶⠀⠼⠉"); } #[test] fn ex_7_32() { let expr= r#"anam=am+ nmn"#; test_braille("Swedish", expr, "⠬⠝⠩⠁⠱⠬⠍⠩⠁⠀⠶⠀⠘⠬⠍⠝⠱⠩⠁⠘⠬⠍⠲⠝⠱"); } #[test] fn ex_11_4() { let expr= r#"a= Fm= m·v2rm a=r·ω2"#; test_braille("Swedish", expr, "⠁⠀⠶⠀⠠⠋⠳⠍⠀⠶⠀⠿⠦⠍⠻⠄⠧⠬⠼⠃⠳⠗⠳⠳⠍⠿⠴⠀⠶⠕⠀⠁⠀⠶⠀⠗⠀⠻⠄⠀⠰⠺⠬⠼⠃"); }