aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/constant.rs46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/constant.rs b/src/constant.rs
index c98c24d..d2fb238 100644
--- a/src/constant.rs
+++ b/src/constant.rs
@@ -2576,3 +2576,49 @@ pub const CHARACTER_REFERENCE_VALUES: [&str; 2222] = [
"⟶", "𝓍", "⨆", "⨄", "△", "⋁", "⋀", "ý", "ý", "я", "ŷ", "ы", "¥", "¥", "𝔶", "ї", "𝕪", "𝓎", "ю",
"ÿ", "ÿ", "ź", "ž", "з", "ż", "ℨ", "ζ", "𝔷", "ж", "⇝", "𝕫", "𝓏", "‍", "‌",
];
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn constants() {
+ assert_eq!(
+ CHARACTER_REFERENCE_DECIMAL_SIZE_MAX,
+ format!("{}", 0x10ffff).len(),
+ "`CHARACTER_REFERENCE_DECIMAL_SIZE_MAX`"
+ );
+
+ assert_eq!(
+ CHARACTER_REFERENCE_HEXADECIMAL_SIZE_MAX,
+ format!("{:x}", 0x10ffff).len(),
+ "`CHARACTER_REFERENCE_HEXADECIMAL_SIZE_MAX`"
+ );
+
+ assert_eq!(
+ CHARACTER_REFERENCE_NAMED_SIZE_MAX,
+ longest(&CHARACTER_REFERENCE_NAMES).unwrap().len(),
+ "`CHARACTER_REFERENCE_NAMED_SIZE_MAX`"
+ );
+
+ assert_eq!(
+ HTML_RAW_SIZE_MAX,
+ longest(&HTML_RAW_NAMES).unwrap().len(),
+ "`HTML_RAW_SIZE_MAX`"
+ );
+ }
+
+ fn longest<'a>(list: &[&'a str]) -> Option<&'a str> {
+ let mut max = 0;
+ let mut result = None;
+ for name in list.iter() {
+ let len = name.len();
+ if len > max {
+ max = len;
+ result = Some(*name);
+ }
+ }
+
+ result
+ }
+}