Skip to content

Commit

Permalink
test: ID::to_u64 and ID::from_u64
Browse files Browse the repository at this point in the history
  • Loading branch information
vnprc committed Nov 10, 2024
1 parent 09a8bd3 commit 9f0951b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
11 changes: 11 additions & 0 deletions crates/cdk/src/nuts/nut02.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,4 +561,15 @@ mod test {
let id_from_uppercase = Id::from_str(&SHORT_KEYSET_ID.to_uppercase());
assert!(id_from_uppercase.is_ok());
}

#[test]
fn test_id_u64_conversion() {
let id = generate_random_id();
let u64_value = id.to_u64();
let converted_id = Id::from_u64(u64_value).unwrap();

assert_eq!(id, converted_id);
assert_eq!(id.version, converted_id.version);
assert_eq!(id.id, converted_id.id);
}
}

0 comments on commit 9f0951b

Please sign in to comment.