// Nemeth tests from the 2023 chemistry spec // https://www.brailleauthority.org/sites/default/files/chemistry/Chemical%20Notation%20Using%20the%20Nemeth%20Braille%20Code%202023.pdf // The numbering refers to the sections in that reference. // The MathML comes from ChemType (basically WIRIS's tweak to the online MathType editor) or mhchem (indicated in test name) use crate::common::*; #[test] fn bond_2_1() { let expr = r#"H-Be-H"#; test_braille("Nemeth", expr, "⠠⠓⠸⠒⠻⠠⠃⠑⠸⠒⠻⠠⠓"); } #[test] fn bond_2_2() { let expr = r#"H2C= CH2"#; test_braille("Nemeth", expr, "⠠⠓⠆⠠⠉⠸⠶⠻⠠⠉⠠⠓⠆"); } #[test] fn bond_2_2_mhchem() { let expr = r#" H A 2 C = CH A 2 "#; test_braille("Nemeth", expr, "⠠⠓⠆⠠⠉⠸⠶⠻⠠⠉⠠⠓⠆"); } #[test] fn bond_2_3() { let expr = r#"H-C C-H"#; test_braille("Nemeth", expr, "⠠⠓⠸⠒⠻⠠⠉⠸⠿⠻⠠⠉⠸⠒⠻⠠⠓"); } #[test] fn bond_2_5() { let expr = r#"Fe+Cl2 = FeCl3"#; test_braille("Nemeth", expr, "⠠⠋⠑⠬⠠⠉⠇⠆⠀⠨⠅⠀⠠⠋⠑⠠⠉⠇⠒"); } // FIX: add tests for 2.2.2: Horizontal Arrow Bonds (these are not currently known by MathCAT) #[test] fn arrow_bond_sec_2_2_2_c() { let expr = r#"2Na+Cl2 2NaCl"#; test_braille("Nemeth", expr, "⠼⠆⠠⠝⠁⠬⠠⠉⠇⠆⠀⠫⠕⠀⠼⠆⠠⠝⠁⠠⠉⠇"); } #[test] fn arrow_bond_sec_2_2_2_d() { let expr = r#" RNH2+RX R2 NH2+X-"#; test_braille("Nemeth", expr, "⠠⠗⠠⠝⠠⠓⠆⠬⠠⠗⠠⠭⠀⠫⠕⠀⠠⠗⠆⠠⠝⠠⠓⠆⠐⠘⠬⠐⠠⠭⠘⠤"); } #[test] fn arrow_bond_sec_2_2_2_d_mhchem() { // changed long right arrow to short right arrow as that is what the example (wrongly) uses let expr = r#" RNH A 2 + RX R A 2 NH A 2 A + X A "#; test_braille("Nemeth", expr, "⠠⠗⠠⠝⠠⠓⠆⠬⠠⠗⠠⠭⠀⠫⠕⠀⠠⠗⠆⠠⠝⠠⠓⠆⠐⠘⠬⠐⠠⠭⠘⠤"); } #[test] fn lewis_2_20() { let expr = r#"HO2+NO NO2+OH"#; test_braille("Nemeth", expr, "⠠⠓⠠⠕⠆⠬⠠⠝⠠⠕⠀⠫⠕⠀⠠⠝⠠⠕⠆⠬⠡⠠⠕⠠⠓"); } #[test] fn lewis_2_21() { let expr = r#"R+CH3 RCH3"#; test_braille("Nemeth", expr, "⠠⠗⠡⠬⠡⠠⠉⠠⠓⠒⠀⠫⠕⠀⠠⠗⠠⠉⠠⠓⠒"); } #[test] fn lewis_2_22() { let expr = r#"[CH3]"#; test_braille("Nemeth", expr, "⠈⠷⠠⠉⠠⠓⠒⠈⠾⠡"); } #[test] fn dots_2_37_a() { let expr = r#":N:::N:"#; test_braille("Nemeth", expr, "⠹⠠⠝⠨⠹⠠⠝⠹"); } #[test] fn dots_2_37_b() { // Note: this uses vertical ellipsis for the triple vertical dot. There is also U+205D, but's pretty ubscure. let expr = r#"H:C C:H"#; test_braille("Nemeth", expr, "⠠⠓⠹⠠⠉⠨⠹⠠⠉⠹⠠⠓"); } #[test] fn yields_3_1() { let expr = r#"CH4(g)+ 2O2(g) CO2(g)+ 2H2O(g)"#; test_braille("Nemeth", expr, "⠠⠉⠠⠓⠲⠷⠛⠾⠬⠆⠠⠕⠆⠷⠛⠾⠀⠫⠕⠀⠠⠉⠠⠕⠆⠷⠛⠾⠬⠆⠠⠓⠆⠠⠕⠷⠛⠾"); } #[test] fn reverse_3_2() { let expr = r#"N2+ 3H2 2NH3"#; test_braille("Nemeth", expr, "⠠⠝⠆⠬⠒⠠⠓⠆⠀⠫⠪⠒⠒⠀⠼⠆⠠⠝⠠⠓⠒"); } #[test] fn reaction_arrow_3_9() { let expr = r#"H2(g)+ I2(g) 2HI(g)"#; test_braille("Nemeth", expr, "⠠⠓⠆⠷⠛⠾⠬⠠⠊⠆⠷⠛⠾⠀⠫⠒⠕⠫⠪⠒⠀⠼⠆⠠⠓⠠⠊⠷⠛⠾"); } #[test] fn reaction_arrow_3_13() { let expr = r#"H3C- C C-Na+ +NH3 H3C- CC- H+ Na+NH2-"#; test_braille("Nemeth", expr, "⠠⠓⠒⠠⠉⠸⠒⠻⠠⠉⠸⠿⠻⠠⠉⠘⠤⠐⠠⠝⠁⠘⠬⠐⠬⠠⠝⠠⠓⠒⠀⠫⠪⠒⠒⠫⠒⠕⠀⠠⠓⠒⠠⠉⠸⠒⠻⠠⠉⠸⠿⠻⠠⠉⠸⠒⠻⠠⠓⠬⠠⠝⠁⠘⠬⠐⠠⠝⠠⠓⠆⠐⠘⠤"); } #[test] fn reaction_arrow_3_14_a() { // Note: this uses an arrow rather than harpoon because Unicode currently lacks the symbol (braille should be the same) // There's not enough chemistry to pick up (value=3), so intent is added let expr = r#"RP"#; test_braille("Nemeth", expr, "⠠⠗⠀⠫⠒⠒⠕⠫⠪⠒⠀⠠⠏"); } #[test] fn reaction_arrow_3_14_b() { // Note: this uses an arrow rather than harpoon because Unicode currently lacks the symbol (braille should be the same) // There's not enough chemistry to pick up (value=3), so intent is added let expr = r#"RP"#; test_braille("Nemeth", expr, "⠠⠗⠀⠫⠒⠕⠫⠪⠒⠒⠀⠠⠏"); } #[test] fn arrow_3_36() { let expr = r#"2Al+2NaOH+ 2H2O Na2Al2O4+ 3H2"#; test_braille("Nemeth", expr, "⠼⠆⠠⠁⠇⠬⠆⠠⠝⠁⠠⠕⠠⠓⠬⠆⠠⠓⠆⠠⠕⠀⠫⠕⠀⠠⠝⠁⠆⠠⠁⠇⠆⠠⠕⠲⠬⠒⠠⠓⠆⠫⠣"); } #[test] fn arrow_3_37() { let expr = r#"Ca(HCO3)2+ Ca(OH)2 2CaCO3+ 2H2O"#; test_braille("Nemeth", expr, "⠠⠉⠁⠷⠠⠓⠠⠉⠠⠕⠒⠾⠰⠆⠐⠬⠠⠉⠁⠷⠠⠕⠠⠓⠾⠰⠆⠀⠫⠕⠀⠼⠆⠠⠉⠁⠠⠉⠠⠕⠒⠫⠩⠀⠬⠆⠠⠓⠆⠠⠕"); } #[test] fn dot_4_5() { let expr = r#"K1 [PCl5]= K2[PCl3]· [Cl2]"#; test_braille("Nemeth", expr, "⠠⠅⠂⠈⠷⠠⠏⠠⠉⠇⠢⠈⠾⠀⠨⠅⠀⠠⠅⠆⠈⠷⠠⠏⠠⠉⠇⠒⠈⠾⠡⠈⠷⠠⠉⠇⠆⠈⠾"); } #[test] fn charge_5_1_c() { let expr = r#"2Al 2Al3++ 6e-"#; test_braille("Nemeth", expr, "⠼⠆⠠⠁⠇⠀⠫⠕⠀⠼⠆⠠⠁⠇⠘⠒⠬⠐⠬⠖⠑⠘⠤"); } #[test] fn charge_5_3_a() { let expr = r#"HPO4--"#; test_braille("Nemeth", expr, "⠠⠓⠠⠏⠠⠕⠲⠐⠘⠆⠤"); } #[test] fn charge_5_3_b() { let expr = r#" He24 ++"#; test_braille("Nemeth", expr, "⠰⠆⠘⠲⠐⠠⠓⠑⠘⠆⠬"); } #[test] fn simultaneious_scripts_5_8_b() { let expr = r#"SO42-"#; test_braille("Nemeth", expr, "⠠⠎⠠⠕⠲⠘⠆⠤"); } #[test] fn staggered_scripts_5_9_a() { let expr = r#"5C2 O42- (aq)"#; test_braille("Nemeth", expr, "⠼⠢⠠⠉⠆⠠⠕⠲⠐⠘⠆⠤⠐⠷⠁⠟⠾"); } #[test] fn staggered_scripts_5_9_b() { let expr = r#"(SiO3) n 2n-"#; test_braille("Nemeth", expr, "⠷⠠⠎⠊⠠⠕⠒⠾⠰⠝⠐⠘⠆⠝⠤"); } #[test] fn state_5_10() { let expr = r#"H(reaction)°"#; // the chem book seems to have a bug in using dot 5 in the first delta expr. They have "⠨⠠⠙⠠⠓⠘⠨⠡⠐⠰⠷⠗⠑⠁⠉⠞⠊⠕⠝⠾". // I sent a bug report in bug haven't heard back. This tests assumes the book has a bug test_braille("Nemeth", expr, "⠨⠠⠙⠠⠓⠘⠨⠡⠰⠷⠗⠑⠁⠉⠞⠊⠕⠝⠾"); } #[test] fn state_as_subscript_5_13() { let expr = r#"Sn (aq) 2+"#; test_braille("Nemeth", expr, "⠠⠎⠝⠘⠆⠬⠐⠷⠁⠟⠾"); } #[test] fn prescripts_5_14() { let expr = r#"Es99254+ He24 Md101256+ 2n01"#; test_braille("Nemeth", expr, "⠰⠔⠔⠘⠆⠢⠲⠐⠠⠑⠎⠬⠰⠆⠘⠲⠐⠠⠓⠑⠀⠫⠕⠀⠰⠂⠴⠂⠘⠆⠢⠖⠐⠠⠍⠙⠬⠆⠰⠴⠘⠂⠐⠝"); }