aboutsummaryrefslogtreecommitdiffstats
path: root/matcher/src/chars/normalize.rs
diff options
context:
space:
mode:
Diffstat (limited to 'matcher/src/chars/normalize.rs')
-rw-r--r--matcher/src/chars/normalize.rs972
1 files changed, 972 insertions, 0 deletions
diff --git a/matcher/src/chars/normalize.rs b/matcher/src/chars/normalize.rs
new file mode 100644
index 00000000..3de501aa
--- /dev/null
+++ b/matcher/src/chars/normalize.rs
@@ -0,0 +1,972 @@
+/// Normalize a Unicode character by converting Latin characters which are variants
+/// of ASCII characters to their latin equivalent.
+///
+/// Note that this method acts on single `char`s: if you want to perform full normalization, you
+/// should first split on graphemes, and then normalize each grapheme by normalizing the first
+/// `char` in the grapheme.
+///
+/// If a character does not normalize to a single ASCII character, no normalization is performed.
+///
+/// This performs normalization within the following Unicode blocks:
+///
+/// - [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement)
+/// - [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
+/// - [Latin Extended-B](https://en.wikipedia.org/wiki/Latin_Extended-B)
+/// - [Latin Extended Additional](https://en.wikipedia.org/wiki/Latin_Extended_Additional)
+/// - [Superscripts and Subscripts](https://en.wikipedia.org/wiki/Superscripts_and_Subscripts)
+///
+/// If the character does not fall in this block, it is not normalized.
+///
+/// # Example
+/// ```
+/// # use nucleo_matcher::chars::normalize;
+/// assert_eq!(normalize('ä'), 'a');
+/// assert_eq!(normalize('Æ'), 'Æ');
+/// assert_eq!(normalize('ữ'), 'u');
+/// ```
+pub fn normalize(c: char) -> char {
+ // outside checked blocks
+ if c < '\u{a0}' || c >= '\u{20A0}' {
+ return c;
+ }
+ // Latin-1 Supplement, Extended-A, Extended-B
+ if c <= '\u{29f}' {
+ return LATIN_1AB[c as usize - '\u{a0}' as usize];
+ }
+ // between blocks
+ if c < '\u{1e00}' {
+ return c;
+ }
+ // Latin Extended Additional
+ if c <= '\u{1eff}' {
+ return LATIN_EXTENDED_ADDITIONAL[c as usize - '\u{1e00}' as usize];
+ }
+ // between blocks
+ if c < '\u{2070}' {
+ return c;
+ }
+ // Superscripts and subscripts
+ SUPERSCRIPTS_AND_SUBSCRIPTS[c as usize - '\u{2070}' as usize]
+}
+
+/// A char array corresponding to the following contiguous Unicode blocks:
+///
+/// - [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement)
+/// - [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
+/// - [Latin Extended-B](https://en.wikipedia.org/wiki/Latin_Extended-B)
+///
+/// This covers the range `'\u{a0}'..='\u{29f}'`.
+static LATIN_1AB: [char; 512] = [
+ '\u{a0}', // invisible NON BREAKING SPACE
+ '!', // '¡'; '\u{a1}'
+ '¢', // '¢'; '\u{a2}'
+ '£', // '£'; '\u{a3}'
+ '¤', // '¤'; '\u{a4}'
+ '¥', // '¥'; '\u{a5}'
+ '¦', // '¦'; '\u{a6}'
+ '§', // '§'; '\u{a7}'
+ '¨', // '¨'; '\u{a8}'
+ '©', // '©'; '\u{a9}'
+ 'a', // 'ª'; '\u{aa}'
+ '«', // '«'; '\u{ab}'
+ '¬', // '¬'; '\u{ac}'
+ '\u{ad}', // invisible SOFT HYPHEN
+ '®', // '®'; '\u{ae}'
+ '¯', // '¯'; '\u{af}'
+ '°', // '°'; '\u{b0}'
+ '±', // '±'; '\u{b1}'
+ '2', // '²'; '\u{b2}'
+ '3', // '³'; '\u{b3}'
+ '´', // '´'; '\u{b4}'
+ 'µ', // 'µ'; '\u{b5}'
+ '¶', // '¶'; '\u{b6}'
+ '·', // '·'; '\u{b7}'
+ '¸', // '¸'; '\u{b8}'
+ '1', // '¹'; '\u{b9}'
+ '0', // 'º'; '\u{ba}'
+ '»', // '»'; '\u{bb}'
+ '¼', // '¼'; '\u{bc}'
+ '½', // '½'; '\u{bd}'
+ '¾', // '¾'; '\u{be}'
+ '?', // '¿'; '\u{bf}'
+ 'A', // 'À'; '\u{c0}'
+ 'A', // 'Á'; '\u{c1}'
+ 'A', // 'Â'; '\u{c2}'
+ 'A', // 'Ã'; '\u{c3}'
+ 'A', // 'Ä'; '\u{c4}'
+ 'A', // 'Å'; '\u{c5}'
+ 'Æ', // 'Æ'; '\u{c6}'
+ 'C', // 'Ç'; '\u{c7}'
+ 'E', // 'È'; '\u{c8}'
+ 'E', // 'É'; '\u{c9}'
+ 'E', // 'Ê'; '\u{ca}'
+ 'E', // 'Ë'; '\u{cb}'
+ 'I', // 'Ì'; '\u{cc}'
+ 'I', // 'Í'; '\u{cd}'
+ 'I', // 'Î'; '\u{ce}'
+ 'I', // 'Ï'; '\u{cf}'
+ 'D', // 'Ð'; '\u{d0}'
+ 'N', // 'Ñ'; '\u{d1}'
+ 'O', // 'Ò'; '\u{d2}'
+ 'O', // 'Ó'; '\u{d3}'
+ 'O', // 'Ô'; '\u{d4}'
+ 'O', // 'Õ'; '\u{d5}'
+ 'O', // 'Ö'; '\u{d6}'
+ '×', // '×'; '\u{d7}'
+ 'O', // 'Ø'; '\u{d8}'
+ 'U', // 'Ù'; '\u{d9}'
+ 'U', // 'Ú'; '\u{da}'
+ 'U', // 'Û'; '\u{db}'
+ 'U', // 'Ü'; '\u{dc}'
+ 'Y', // 'Ý'; '\u{dd}'
+ 'Þ', // 'Þ'; '\u{de}'
+ 's', // 'ß'; '\u{df}'
+ 'a', // 'à'; '\u{e0}'
+ 'a', // 'á'; '\u{e1}'
+ 'a', // 'â'; '\u{e2}'
+ 'a', // 'ã'; '\u{e3}'
+ 'a', // 'ä'; '\u{e4}'
+ 'a', // 'å'; '\u{e5}'
+ 'æ', // 'æ'; '\u{e6}'
+ 'c', // 'ç'; '\u{e7}'
+ 'e', // 'è'; '\u{e8}'
+ 'e', // 'é'; '\u{e9}'
+ 'e', // 'ê'; '\u{ea}'
+ 'e', // 'ë'; '\u{eb}'
+ 'i', // 'ì'; '\u{ec}'
+ 'i', // 'í'; '\u{ed}'
+ 'i', // 'î'; '\u{ee}'
+ 'i', // 'ï'; '\u{ef}'
+ 'd', // 'ð'; '\u{f0}'
+ 'n', // 'ñ'; '\u{f1}'
+ 'o', // 'ò'; '\u{f2}'
+ 'o', // 'ó'; '\u{f3}'
+ 'o', // 'ô'; '\u{f4}'
+ 'o', // 'õ'; '\u{f5}'
+ 'o', // 'ö'; '\u{f6}'
+ '÷', // '÷'; '\u{f7}'
+ 'o', // 'ø'; '\u{f8}'
+ 'u', // 'ù'; '\u{f9}'
+ 'u', // 'ú'; '\u{fa}'
+ 'u', // 'û'; '\u{fb}'
+ 'u', // 'ü'; '\u{fc}'
+ 'y', // 'ý'; '\u{fd}'
+ 'þ', // 'þ'; '\u{fe}'
+ 'y', // 'ÿ'; '\u{ff}'
+ 'A', // 'Ā'; '\u{100}'
+ 'a', // 'ā'; '\u{101}'
+ 'A', // 'Ă'; '\u{102}'
+ 'a', // 'ă'; '\u{103}'
+ 'A', // 'Ą'; '\u{104}'
+ 'a', // 'ą'; '\u{105}'
+ 'C', // 'Ć'; '\u{106}'
+ 'c', // 'ć'; '\u{107}'
+ 'C', // 'Ĉ'; '\u{108}'
+ 'c', // 'ĉ'; '\u{109}'
+ 'C', // 'Ċ'; '\u{10a}'
+ 'c', // 'ċ'; '\u{10b}'
+ 'C', // 'Č'; '\u{10c}'
+ 'c', // 'č'; '\u{10d}'
+ 'D', // 'Ď'; '\u{10e}'
+ 'd', // 'ď'; '\u{10f}'
+ 'D', // 'Đ'; '\u{110}'
+ 'd', // 'đ'; '\u{111}'
+ 'E', // 'Ē'; '\u{112}'
+ 'e', // 'ē'; '\u{113}'
+ 'E', // 'Ĕ'; '\u{114}'
+ 'e', // 'ĕ'; '\u{115}'
+ 'E', // 'Ė'; '\u{116}'
+ 'e', // 'ė'; '\u{117}'
+ 'E', // 'Ę'; '\u{118}'
+ 'e', // 'ę'; '\u{119}'
+ 'E', // 'Ě'; '\u{11a}'
+ 'e', // 'ě'; '\u{11b}'
+ 'G', // 'Ĝ'; '\u{11c}'
+ 'g', // 'ĝ'; '\u{11d}'
+ 'G', // 'Ğ'; '\u{11e}'
+ 'g', // 'ğ'; '\u{11f}'
+ 'G', // 'Ġ'; '\u{120}'
+ 'g', // 'ġ'; '\u{121}'
+ 'G', // 'Ģ'; '\u{122}'
+ 'g', // 'ģ'; '\u{123}'
+ 'H', // 'Ĥ'; '\u{124}'
+ 'h', // 'ĥ'; '\u{125}'
+ 'H', // 'Ħ'; '\u{126}'
+ 'h', // 'ħ'; '\u{127}'
+ 'I', // 'Ĩ'; '\u{128}'
+ 'i', // 'ĩ'; '\u{129}'
+ 'I', // 'Ī'; '\u{12a}'
+ 'i', // 'ī'; '\u{12b}'
+ 'I', // 'Ĭ'; '\u{12c}'
+ 'i', // 'ĭ'; '\u{12d}'
+ 'I', // 'Į'; '\u{12e}'
+ 'i', // 'į'; '\u{12f}'
+ 'I', // 'İ'; '\u{130}'
+ 'i', // 'ı'; '\u{131}'
+ 'IJ', // 'IJ'; '\u{132}'
+ 'ij', // 'ij'; '\u{133}'
+ 'J', // 'Ĵ'; '\u{134}'
+ 'j', // 'ĵ'; '\u{135}'
+ 'K', // 'Ķ'; '\u{136}'
+ 'k', // 'ķ'; '\u{137}'
+ 'ĸ', // 'ĸ'; '\u{138}'
+ 'L', // 'Ĺ'; '\u{139}'
+ 'l', // 'ĺ'; '\u{13a}'
+ 'L', // 'Ļ'; '\u{13b}'
+ 'l', // 'ļ'; '\u{13c}'
+ 'L', // 'Ľ'; '\u{13d}'
+ 'l', // 'ľ'; '\u{13e}'
+ 'L', // 'Ŀ'; '\u{13f}'
+ 'l', // 'ŀ'; '\u{140}'
+ 'L', // 'Ł'; '\u{141}'
+ 'l', // 'ł'; '\u{142}'
+ 'N', // 'Ń'; '\u{143}'
+ 'n', // 'ń'; '\u{144}'
+ 'N', // 'Ņ'; '\u{145}'
+ 'n', // 'ņ'; '\u{146}'
+ 'N', // 'Ň'; '\u{147}'
+ 'n', // 'ň'; '\u{148}'
+ 'n', // 'ʼn'; '\u{149}'
+ 'N', // 'Ŋ'; '\u{14a}'
+ 'n', // 'ŋ'; '\u{14b}'
+ 'O', // 'Ō'; '\u{14c}'
+ 'o', // 'ō'; '\u{14d}'
+ 'O', // 'Ŏ'; '\u{14e}'
+ 'o', // 'ŏ'; '\u{14f}'
+ 'O', // 'Ő'; '\u{150}'
+ 'o', // 'ő'; '\u{151}'
+ 'Œ', // 'Œ'; '\u{152}'
+ 'œ', // 'œ'; '\u{153}'
+ 'R', // 'Ŕ'; '\u{154}'
+ 'r', // 'ŕ'; '\u{155}'
+ 'R', // 'Ŗ'; '\u{156}'
+ 'r', // 'ŗ'; '\u{157}'
+ 'R', // 'Ř'; '\u{158}'
+ 'r', // 'ř'; '\u{159}'
+ 'S', // 'Ś'; '\u{15a}'
+ 's', // 'ś'; '\u{15b}'
+ 'S', // 'Ŝ'; '\u{15c}'
+ 's', // 'ŝ'; '\u{15d}'
+ 'S', // 'Ş'; '\u{15e}'
+ 's', // 'ş'; '\u{15f}'
+ 'S', // 'Š'; '\u{160}'
+ 's', // 'š'; '\u{161}'
+ 'T', // 'Ţ'; '\u{162}'
+ 't', // 'ţ'; '\u{163}'
+ 'T', // 'Ť'; '\u{164}'
+ 't', // 'ť'; '\u{165}'
+ 'T', // 'Ŧ'; '\u{166}'
+ 't', // 'ŧ'; '\u{167}'
+ 'U', // 'Ũ'; '\u{168}'
+ 'u', // 'ũ'; '\u{169}'
+ 'U', // 'Ū'; '\u{16a}'
+ 'u', // 'ū'; '\u{16b}'
+ 'U', // 'Ŭ'; '\u{16c}'
+ 'u', // 'ŭ'; '\u{16d}'
+ 'U', // 'Ů'; '\u{16e}'
+ 'u', // 'ů'; '\u{16f}'
+ 'U', // 'Ű'; '\u{170}'
+ 'u', // 'ű'; '\u{171}'
+ 'U', // 'Ų'; '\u{172}'
+ 'u', // 'ų'; '\u{173}'
+ 'W', // 'Ŵ'; '\u{174}'
+ 'w', // 'ŵ'; '\u{175}'
+ 'Y', // 'Ŷ'; '\u{176}'
+ 'y', // 'ŷ'; '\u{177}'
+ 'Y', // 'Ÿ'; '\u{178}'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}'
+ 'G', // 'ʛ'; '\u{29b}'
+ 'H', // 'ʜ'; '\u{29c}'
+ 'j', // 'ʝ'; '\u{29d}'
+ 'k', // 'ʞ'; '\u{29e}'
+ 'L', // 'ʟ'; '\u{29f}'
+];
+
+/// A char array corresponding to the following Unicode block:
+///
+/// - [Latin Extended Additional](https://en.wikipedia.org/wiki/Latin_Extended_Additional)
+///
+/// This covers the range `'\u{1e00}'..='\u{1eff}'`.
+static LATIN_EXTENDED_ADDITIONAL: [char; 256] = [
+ 'A', // 'Ḁ'; '\u{1e00}'
+ 'a', // 'ḁ'; '\u{1e01}'
+ 'B', // 'Ḃ'; '\u{1e02}'
+ 'b', // 'ḃ'; '\u{1e03}'
+ 'B', // 'Ḅ'; '\u{1e04}'
+ 'b', // 'ḅ'; '\u{1e05}'
+ 'B', // 'Ḇ'; '\u{1e06}'
+ 'b', // 'ḇ'; '\u{1e07}'
+ 'C', // 'Ḉ'; '\u{1e08}'
+ 'c', // 'ḉ'; '\u{1e09}'
+ 'D', // 'Ḋ'; '\u{1e0a}'
+ 'e', // 'ḋ'; '\u{1e0b}'
+ 'D', // 'Ḍ'; '\u{1e0c}'
+ 'd', // 'ḍ'; '\u{1e0d}'
+ 'D', // 'Ḏ'; '\u{1e0e}'
+ 'd', // 'ḏ'; '\u{1e0f}'
+ 'D', // 'Ḑ'; '\u{1e10}'
+ 'd', // 'ḑ'; '\u{1e11}'
+ 'D', // 'Ḓ'; '\u{1e12}'
+ 'd', // 'ḓ'; '\u{1e13}'
+ 'E', // 'Ḕ'; '\u{1e14}'
+ 'e', // 'ḕ'; '\u{1e15}'
+ 'E', // 'Ḗ'; '\u{1e16}'
+ 'e', // 'ḗ'; '\u{1e17}'
+ 'E', // 'Ḙ'; '\u{1e18}'
+ 'e', // 'ḙ'; '\u{1e19}'
+ 'E', // 'Ḛ'; '\u{1e1a}'
+ 'e', // 'ḛ'; '\u{1e1b}'
+ 'E', // 'Ḝ'; '\u{1e1c}'
+ 'e', // 'ḝ'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', // 'Ẽ'; '\u{1ebc}'
+ 'e', // 'ẽ'; '\u{1ebd}'
+ 'E', // 'Ế'; '\u{1ebe}'
+ 'e', // 'ế'; '\u{1ebf}'
+ 'E', // 'Ề'; '\u{1ec0}'
+ 'e', // 'ề'; '\u{1ec1}'
+ 'E', // 'Ể'; '\u{1ec2}'
+ 'e', // 'ể'; '\u{1ec3}'
+ 'E', // 'Ễ'; '\u{1ec4}'
+ 'e', // 'ễ'; '\u{1ec5}'
+ 'E', // 'Ệ'; '\u{1ec6}'
+ 'e', // 'ệ'; '\u{1ec7}'
+ 'I', // 'Ỉ'; '\u{1ec8}'
+ 'i', // 'ỉ'; '\u{1ec9}'
+ 'I', // 'Ị'; '\u{1eca}'
+ 'i', // 'ị'; '\u{1ecb}'
+ 'O', // 'Ọ'; '\u{1ecc}'
+ 'o', // 'ọ'; '\u{1ecd}'
+ 'O', // 'Ỏ'; '\u{1ece}'
+ 'o', // 'ỏ'; '\u{1ecf}'
+ 'O', // 'Ố'; '\u{1ed0}'
+ 'o', // 'ố'; '\u{1ed1}'
+ 'O', // 'Ồ'; '\u{1ed2}'
+ 'o', // 'ồ'; '\u{1ed3}'
+ 'O', // 'Ổ'; '\u{1ed4}'
+ 'o', // 'ổ'; '\u{1ed5}'
+ 'O', // 'Ỗ'; '\u{1ed6}'
+ 'o', // 'ỗ'; '\u{1ed7}'
+ 'O', // 'Ộ'; '\u{1ed8}'
+ 'o', // 'ộ'; '\u{1ed9}'
+ 'O', // 'Ớ'; '\u{1eda}'
+ 'o', // 'ớ'; '\u{1edb}'
+ 'O', // 'Ờ'; '\u{1edc}'
+ 'o', // 'ờ'; '\u{1edd}'
+ 'O', // 'Ở'; '\u{1ede}'
+ 'o', // 'ở'; '\u{1edf}'
+ 'O', // 'Ỡ'; '\u{1ee0}'
+ 'o', // 'ỡ'; '\u{1ee1}'
+ 'O', // 'Ợ'; '\u{1ee2}'
+ 'o', // 'ợ'; '\u{1ee3}'
+ 'U', // 'Ụ'; '\u{1ee4}'
+ 'u', // 'ụ'; '\u{1ee5}'
+ 'U', // 'Ủ'; '\u{1ee6}'
+ 'u', // 'ủ'; '\u{1ee7}'
+ 'U', // 'Ứ'; '\u{1ee8}'
+ 'u', // 'ứ'; '\u{1ee9}'
+ 'U', // 'Ừ'; '\u{1eea}'
+ 'u', // 'ừ'; '\u{1eeb}'
+ 'U', // 'Ử'; '\u{1eec}'
+ 'u', // 'ử'; '\u{1eed}'
+ 'U', // 'Ữ'; '\u{1eee}'
+ 'u', // 'ữ'; '\u{1eef}'
+ 'U', // 'Ự'; '\u{1ef0}'
+ 'u', // 'ự'; '\u{1ef1}'
+ 'Y', // 'Ỳ'; '\u{1ef2}'
+ 'y', // 'ỳ'; '\u{1ef3}'
+ 'Y', // 'Ỵ'; '\u{1ef4}'
+ 'y', // 'ỵ'; '\u{1ef5}'
+ 'Y', // 'Ỷ'; '\u{1ef6}'
+ 'y', // 'ỷ'; '\u{1ef7}'
+ 'Y', // 'Ỹ'; '\u{1ef8}'
+ 'y', // 'ỹ'; '\u{1ef9}'
+ 'Ỻ', // 'Ỻ'; '\u{1efa}'
+ 'ỻ', // 'ỻ'; '\u{1efb}'
+ 'Ỽ', // 'Ỽ'; '\u{1efc}'
+ 'ỽ', // 'ỽ'; '\u{1efd}'
+ 'Ỿ', // 'Ỿ'; '\u{1efe}'
+ 'ỿ', // 'ỿ'; '\u{1eff}'
+];
+
+/// A char array corresponding to the following Unicode block:
+///
+/// - [Superscripts and Subscripts](https://en.wikipedia.org/wiki/Superscripts_and_Subscripts)
+///
+/// This covers the range `'\u{2070}'..='\u{209f}'`.
+static SUPERSCRIPTS_AND_SUBSCRIPTS: [char; 48] = [
+ '0', // '⁰'; '\u{2070}'
+ 'i', // 'ⁱ'; '\u{2071}'
+ '⁲', // '⁲'; '\u{2072}'
+ '⁳', // '⁳'; '\u{2073}'
+ '4', // '⁴'; '\u{2074}'
+ '5', // '⁵'; '\u{2075}'
+ '6', // '⁶'; '\u{2076}'
+ '7', // '⁷'; '\u{2077}'
+ '8', // '⁸'; '\u{2078}'
+ '0', // '⁹'; '\u{2079}'
+ '+', // '⁺'; '\u{207a}'
+ '-', // '⁻'; '\u{207b}'
+ '=', // '⁼'; '\u{207c}'
+ '(', // '⁽'; '\u{207d}'
+ ')', // '⁾'; '\u{207e}'
+ 'n', // 'ⁿ'; '\u{207f}'
+ '0', // '₀'; '\u{2080}'
+ '1', // '₁'; '\u{2081}'
+ '2', // '₂'; '\u{2082}'
+ '3', // '₃'; '\u{2083}'
+ '4', // '₄'; '\u{2084}'
+ '5', // '₅'; '\u{2085}'
+ '6', // '₆'; '\u{2086}'
+ '7', // '₇'; '\u{2087}'
+ '8', // '₈'; '\u{2088}'
+ '9', // '₉'; '\u{2089}'
+ '+', // '₊'; '\u{208a}'
+ '-', // '₋'; '\u{208b}'
+ '=', // '₌'; '\u{208c}'
+ '(', // '₍'; '\u{208d}'
+ ')', // '₎'; '\u{208e}'
+ '₏', // '₏'; '\u{208f}'
+ 'a', // 'ₐ'; '\u{2090}'
+ 'e', // 'ₑ'; '\u{2091}'
+ 'o', // 'ₒ'; '\u{2092}'
+ 'x', // 'ₓ'; '\u{2093}'
+ 'e', // 'ₔ'; '\u{2094}'
+ 'h', // 'ₕ'; '\u{2095}'
+ 'k', // 'ₖ'; '\u{2096}'
+ 'l', // 'ₗ'; '\u{2097}'
+ 'm', // 'ₘ'; '\u{2098}'
+ 'n', // 'ₙ'; '\u{2099}'
+ 'p', // 'ₚ'; '\u{209a}'
+ 's', // 'ₛ'; '\u{209b}'
+ 't', // 'ₜ'; '\u{209c}'
+ '₝', // '₝'; '\u{209d}'
+ '₞', // '₞'; '\u{209e}'
+ '₟', // '₟'; '\u{209f}'
+];
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ /// Helper function for test assertions.
+ fn check_conversions(pairs: &[(char, char)]) {
+ for (original, normalized) in pairs {
+ assert_eq!(normalize(*original), *normalized);
+ }
+ }
+
+ /// General conversion checks
+ #[test]
+ fn general() {
+ check_conversions(&[
+ ('ą', 'a'),
+ ('À', 'A'),
+ ('ć', 'c'),
+ ('ę', 'e'),
+ ('ł', 'l'),
+ ('ń', 'n'),
+ ('ó', 'o'),
+ ('ś', 's'),
+ ('ź', 'z'),
+ ('ż', 'z'),
+ ('Ą', 'A'),
+ ('Ć', 'C'),
+ ('Ę', 'E'),
+ ('ł', 'l'),
+ ('Ł', 'L'),
+ ('Ń', 'N'),
+ ('Ó', 'O'),
+ ('Ś', 'S'),
+ ('Ź', 'Z'),
+ ('Ż', 'Z'),
+ ('¡', '!'),
+ ]);
+ }
+
+ /// Some checks for characters which are not visible.
+ #[test]
+ fn invisible_chars() {
+ check_conversions(&[('\u{a0}', '\u{a0}'), ('\u{ad}', '\u{ad}')]);
+ }
+
+ /// Check boundary cases in case ranges are modified.
+ #[test]
+ fn boundary_cases() {
+ check_conversions(&[
+ ('\u{9f}', '\u{9f}'),
+ ('\u{a0}', '\u{a0}'),
+ ('¡', '!'),
+ ('ʟ', 'L'),
+ ('\u{2a0}', '\u{2a0}'),
+ ('\u{1dff}', '\u{1dff}'),
+ ('Ḁ', 'A'),
+ ('ỹ', 'y'),
+ ('\u{1eff}', '\u{1eff}'),
+ ('\u{1f00}', '\u{1f00}'),
+ ('⁰', '0'),
+ ('\u{209c}', 't'),
+ ('\u{209f}', '\u{209f}'),
+ ('\u{20a0}', '\u{20a0}'),
+ ]);
+ }
+
+ /// Check that conversions outside the blocks are unchanged.
+ #[test]
+ fn unchanged_outside_blocks() {
+ check_conversions(&[
+ ('a', 'a'),
+ ('⟁', '⟁'),
+ ('┍', '┍'),
+ ('ω', 'ω'),
+ ('⁕', '⁕'),
+ ('ה', 'ה'),
+ ]);
+ }
+}