Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Sep 1, 2023
1 parent 36d7684 commit 79cf63f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,12 @@ mod tables;

use crate::tables::{ASCII_CONTINUE, ASCII_START, CHUNK, LEAF, TRIE_CONTINUE, TRIE_START};

#[inline]
pub fn is_id_start(ch: char) -> bool {
if ch.is_ascii() {
return ASCII_START.0[ch as usize];
}
is_id_continue(ch)
is_id_start_unicode(ch)
}

#[inline]
Expand All @@ -267,6 +268,7 @@ pub fn is_id_start_unicode(ch: char) -> bool {
unsafe { LEAF.0.get_unchecked(offset) }.wrapping_shr(ch as u32 % 8) & 1 != 0
}

#[inline]
pub fn is_id_continue(ch: char) -> bool {
if ch.is_ascii() {
return ASCII_CONTINUE.0[ch as usize];
Expand Down
6 changes: 3 additions & 3 deletions tests/static_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn test_id_size() {
mod tables;

let size = size_of_val(tables::ID_START) + size_of_val(tables::ID_CONTINUE);
assert_eq!(11528, size);
assert_eq!(11416, size);

let _ = tables::BY_NAME;
}
Expand Down Expand Up @@ -70,7 +70,7 @@ fn test_trieset_size() {
+ size_of_val(tree3_level2)
+ size_of_val(tree3_level3);

assert_eq!(10208, start_size + continue_size);
assert_eq!(10192, start_size + continue_size);

let _ = trie::BY_NAME;
}
Expand All @@ -80,7 +80,7 @@ fn test_fst_size() {
let id_start_fst = include_bytes!("fst/id_start.fst");
let id_continue_fst = include_bytes!("fst/id_continue.fst");
let size = id_start_fst.len() + id_continue_fst.len();
assert_eq!(137749, size);
assert_eq!(136291, size);
}

#[test]
Expand Down

0 comments on commit 79cf63f

Please sign in to comment.