Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mplanchard committed Aug 15, 2024
1 parent 59cd0ec commit d58d859
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions crates/cuid1/src/cuid1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,21 +230,21 @@ mod tests {

#[test]
fn cuid_is_cuid() {
assert!(is_cuid(cuid1().unwrap()));
assert!(is_cuid1(cuid1().unwrap()));
}

#[test]
fn cuid_is_not_cuid_zero_len() {
assert!(!is_cuid(""));
assert!(!is_cuid1(""));
}

#[test]
fn slug_len() {
assert!(slug().unwrap().len() == 10);
assert!(cuid1_slug().unwrap().len() == 10);
}

#[test]
fn slug_is_slug() {
assert!(is_slug(slug().unwrap()));
assert!(is_cuid1_slug(cuid1_slug().unwrap()));
}
}
2 changes: 1 addition & 1 deletion crates/cuid1/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! use cuid;
//!
//! // Get a v1 CUID
//! println!("{}", cuid::cuid1());
//! println!("{}", cuid::cuid1().unwrap());
//!
//! // Get a v2 CUID
//! println!("{}", cuid::cuid2());
Expand Down
6 changes: 3 additions & 3 deletions crates/cuid1/tests/cuid1/collisions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mod test {
fn check_cuid_collisions() {
let mut set = HashSet::new();
for _ in 0..1_200_000 {
let id = cuid::cuid().unwrap();
let id = cuid::cuid1().unwrap();
set.insert(id);
}
// we generated unique CUIDs
Expand All @@ -31,7 +31,7 @@ mod test {
let t = thread::spawn(move || {
let mut thread_set = HashSet::new();
for _ in 0..ids_per_thread {
let id = cuid::cuid().unwrap();
let id = cuid::cuid1().unwrap();
thread_set.insert(id);
}
let mut sets = thread_sets.lock().unwrap();
Expand Down Expand Up @@ -79,7 +79,7 @@ mod single_thread {
fn check_slug_collisions() {
let mut set = HashSet::new();
for _ in 0..1_200_000 {
let id = cuid::slug().unwrap();
let id = cuid::cuid1_slug().unwrap();
set.insert(id);
}
// we had no duplicate slugs
Expand Down
4 changes: 2 additions & 2 deletions crates/cuid1/tests/cuid1/length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::collections::HashSet;
fn check_cuid_length() {
let mut set = HashSet::new();
for _ in 0..100000 {
let id = cuid::cuid().unwrap();
let id = cuid::cuid1().unwrap();
set.insert(id);
}
// all CUIDs are of the same length
Expand All @@ -19,7 +19,7 @@ fn check_cuid_length() {
fn check_cuid_slug_length() {
let mut set = HashSet::new();
for _ in 0..100000 {
let id = cuid::slug().unwrap();
let id = cuid::cuid1_slug().unwrap();
set.insert(id);
}
// all slugs are of the same length
Expand Down

0 comments on commit d58d859

Please sign in to comment.