unicode

Branch: main

Switch branches or tags

Branch: main
Go to file t

413 files indexed

History
Code

normalization/internal/fuzz/fuzz.mbt
1///|2/// Normalization-specific fuzz utilities34///|5/// Convert string to array of characters6fn string_to_chars(s : String) -> Array[Char] {7  let result : Array[Char] = []8  for c in s {9    result.push(c)10  }11  result12}1314///|15/// Check if combining marks in a string are sorted by CCC16pub fn ccc_is_sorted(s : String) -> Bool {17  let chars = string_to_chars(s)18  for i = 0, last_ccc = 0, in_combining = false; i < chars.length(); {19    let c = chars[i]20    let ccc = @ccc.lookup_ccc(c)21    if ccc == 0 {22      // Starter - reset23      continue i + 1, 0, false24    } else {25      // Combining mark26      if in_combining && ccc < last_ccc {27        break false // Not sorted28      }29      continue i + 1, ccc, true30    }31  } nobreak {32    true33  }34}35