# Test backtranslation emphasis/typeform detection # # This tests that emphasis indicators in braille are correctly # recognized and the typeform buffer is populated during backtranslation. # # The expected_typeform option specifies the expected typeform output # for each character position. Use emphasis class names (italic, bold, # underline) with '+' for emphasized and ' ' for plain text. display: tables/unicode-without-blank.dis table: tables/en-ueb-g1.ctb flags: testmode: backward tests: - # plain text - no emphasis - "⠓⠑⠇⠇⠕" - "hello" - # single letter italic (dots 46-23) - "⠨⠆⠞⠑⠎⠞" - "test" - expected_typeform: italic: '+ ' - # single letter bold (dots 45-23) - "⠘⠆⠞⠑⠎⠞" - "test" - expected_typeform: bold: '+ ' - # single letter underline (dots 456-23) - "⠸⠆⠞⠑⠎⠞" - "test" - expected_typeform: underline: '+ ' - # word italic with explicit terminator - "⠨⠂⠺⠕⠗⠙⠨⠄" - "word" - expected_typeform: italic: '++++' - # word bold with explicit terminator - "⠘⠂⠺⠕⠗⠙⠘⠄" - "word" - expected_typeform: bold: '++++' - # word underline with explicit terminator - "⠸⠂⠺⠕⠗⠙⠸⠄" - "word" - expected_typeform: underline: '++++' - # phrase italic spanning multiple words - "⠨⠶⠓⠊ ⠞⠓⠑⠗⠑⠨⠄" - "hi there" - expected_typeform: italic: '++++++++' - # mixed text with letter italic in middle - "⠁⠨⠆⠃⠉" - "abc" - expected_typeform: italic: ' + ' - # word emphasis followed by plain text - "⠨⠂⠓⠊⠨⠄ ⠞⠓⠑⠗⠑" - "hi there" - expected_typeform: italic: '++ ' - # nested emphasis - bold word inside italic phrase - "⠨⠶⠓⠊ ⠘⠂⠃⠕⠇⠙⠘⠄ ⠞⠓⠑⠗⠑⠨⠄" - "hi bold there" - expected_typeform: italic: '+++++++++++++' bold: ' ++++ ' - # multiple word emphasis - italic and bold on same word - "⠨⠂⠘⠂⠞⠑⠎⠞⠘⠄⠨⠄" - "test" - expected_typeform: italic: '++++' bold: '++++' - # letter underline inside word italic - "⠨⠂⠞⠸⠆⠑⠎⠞⠨⠄" - "test" - expected_typeform: italic: '++++' underline: ' + ' - # three letter emphasis types on first character - "⠨⠆⠸⠆⠘⠆⠞⠑⠎⠞" - "test" - expected_typeform: italic: '+ ' underline: '+ ' bold: '+ ' # === Edge Case Tests === - # emphasis type transition within word - "⠨⠂⠁⠃⠨⠄⠘⠂⠉⠙⠘⠄" - "abcd" - expected_typeform: italic: '++ ' bold: ' ++' - # punctuation at end of word emphasis - "⠨⠂⠞⠑⠎⠞⠖⠨⠄" - "test!" - expected_typeform: italic: '+++++' - # word emphasis at end of input (no terminator) - "⠨⠂⠞⠑⠎⠞" - "test" - expected_typeform: italic: '++++' - # phrase emphasis at end of input (no terminator) - "⠨⠶⠓⠑⠇⠇⠕" - "hello" - expected_typeform: italic: '+++++' - # letter emphasis at end of input (no character follows) - "⠁⠨⠆" - "a" - expected_typeform: italic: ' ' - # single character letter emphasis - "⠨⠆⠁ ⠃⠉" - "a bc" - expected_typeform: italic: '+ ' - # letter emphasis followed by word emphasis - "⠨⠆⠞⠘⠂⠑⠎⠞⠘⠄" - "test" - expected_typeform: italic: '+ ' bold: ' +++' - # phrase emphasis with mixed punctuation - "⠨⠶⠓⠊⠂ ⠞⠓⠑⠗⠑⠖⠨⠄" - "hi, there!" - expected_typeform: italic: '++++++++++' - # empty input between emphasis indicators - "⠨⠂⠨⠄" - "" - expected_typeform: italic: '' - # bold phrase containing italic word - "⠘⠶⠁ ⠨⠂⠃⠨⠄ ⠉⠘⠄" - "a b c" - expected_typeform: bold: '+++++' italic: ' + ' # Grade 2 contraction tests - verify emphasis applies to all expanded characters table: tables/en-ueb-g2.ctb flags: testmode: backward tests: - # contraction "the" with word italic - all 3 chars get emphasis - "⠨⠂⠮⠨⠄" - "the" - expected_typeform: italic: '+++' - # contraction "and" with word bold - all 3 chars get emphasis - "⠘⠂⠯⠘⠄" - "and" - expected_typeform: bold: '+++' - # contraction "for" with letter italic - all 3 chars get emphasis - "⠨⠆⠿" - "for" - expected_typeform: italic: '+++' - # phrase emphasis spanning multiple contractions - "⠨⠶⠮ ⠯⠨⠄" - "the and" - expected_typeform: italic: '+++++++' - # mixed contractions and regular letters with word emphasis - "⠨⠂⠮⠗⠑⠨⠄" - "there" - expected_typeform: italic: '+++++' - # letter emphasis on contraction followed by plain text - "⠨⠆⠮ ⠺⠕⠗⠙" - "the word" - expected_typeform: italic: '+++ ' - # word emphasis contraction with implicit space termination - "⠨⠂⠮ ⠯" - "the and" - expected_typeform: italic: '++++ ' # === Additional Edge Case Tests === # Reset to Grade 1 for more edge case tests table: tables/en-ueb-g1.ctb flags: testmode: backward tests: - # punctuation followed by space - does punctuation act as word boundary? # begemphword + "hi" + period + space + "no" # Currently only space clears word emphasis, so period should retain emphasis - "⠨⠂⠓⠊⠲ ⠝⠕" - "hi. no" - expected_typeform: italic: '++++ ' - # consecutive word emphasis blocks (same type) # Two separate italic word blocks: "ab" italic, space, "cd" italic - "⠨⠂⠁⠃⠨⠄ ⠨⠂⠉⠙⠨⠄" - "ab cd" - expected_typeform: italic: '++ ++' - # consecutive word emphasis blocks (different types) # Italic word "ab", space, bold word "cd" - "⠨⠂⠁⠃⠨⠄ ⠘⠂⠉⠙⠘⠄" - "ab cd" - expected_typeform: italic: '++ ' bold: ' ++' - # multiple consecutive spaces # Word italic "ab" + multiple spaces + plain "cd" - "⠨⠂⠁⠃ ⠀⠀⠉⠙" - "ab cd" - expected_typeform: italic: '+++ ' - # word emphasis implicit termination followed by NEW word emphasis # italic "hello" + space (implicit termination) + bold "name" + space + plain "is" - "⠨⠂⠓⠑⠇⠇⠕ ⠘⠂⠝⠁⠍⠑⠘⠄ ⠊⠎" - "hello name is" - expected_typeform: italic: '++++++ ' bold: ' ++++ ' - # punctuation immediately followed by new emphasis (no space) # Word italic "hi" + comma + immediately start bold "no" - "⠨⠂⠓⠊⠂⠨⠄⠘⠂⠝⠕⠘⠄" - "hi,no" - expected_typeform: italic: '+++ ' bold: ' ++' - # different emphasis types in sequence separated by space # Italic "ab" + space + bold "cd" + space + underline "ef" - "⠨⠂⠁⠃⠨⠄ ⠘⠂⠉⠙⠘⠄ ⠸⠂⠑⠋⠸⠄" - "ab cd ef" - expected_typeform: italic: '++ ' bold: ' ++ ' underline: ' ++' - # word emphasis without explicit terminator, followed by new word emphasis after space # italic "ab" + space (implicit termination) + bold "cd" - "⠨⠂⠁⠃ ⠘⠂⠉⠙⠘⠄" - "ab cd" - expected_typeform: italic: '+++ ' bold: ' ++' - # comma between two emphasized words with restart # italic "hi" + comma + space + italic "no" (restart emphasis) - "⠨⠂⠓⠊⠂ ⠨⠂⠝⠕⠨⠄" - "hi, no" - expected_typeform: italic: '++++++' - # phrase emphasis spanning punctuation and multiple words # Tests that phrase emphasis is NOT cleared by space - "⠨⠶⠁⠲ ⠃⠲ ⠉⠨⠄" - "a. b. c" - expected_typeform: italic: '+++++++' - # empty word (only space between emphasis indicators) - "⠨⠂ ⠨⠄" - " " - expected_typeform: italic: '+' - # word emphasis at word boundary with following plain text # Tests precise boundary handling - "⠨⠂⠁⠃⠉⠨⠄ ⠙⠑⠋" - "abc def" - expected_typeform: italic: '+++ ' - # two consecutive letter emphasis indicators (different types) # italic letter + bold letter on first char - "⠨⠆⠘⠆⠁⠃⠉" - "abc" - expected_typeform: italic: '+ ' bold: '+ ' - # phrase italic with word bold inside, word bold terminated by space # phrase covers all, word bold on "hi" + space (emphasis applied before clearing at space) - "⠨⠶⠘⠂⠓⠊ ⠞⠓⠑⠗⠑⠨⠄" - "hi there" - expected_typeform: italic: '++++++++' bold: '+++ ' - # multiple word emphasis blocks with no content between # italic word terminator immediately followed by bold word start - "⠨⠂⠁⠃⠨⠄⠘⠂⠉⠙⠘⠄" - "abcd" - expected_typeform: italic: '++ ' bold: ' ++' - # phrase bold terminated correctly (endemph ambiguity) # In UEB, endemphword and endemphphrase bold share the same dot pattern (45-3). # The backtranslator must end phrase emphasis, not just word emphasis. - "⠘⠶⠓⠑⠇⠇⠕⠘⠄ ⠺⠕⠗⠇⠙" - "hello world" - expected_typeform: bold: '+++++ ' - # phrase bold followed by multiple plain words - "⠘⠶⠓⠊⠘⠄ ⠍⠽ ⠝⠁⠍⠑" - "hi my name" - expected_typeform: bold: '++ '