Skip to content

Commit

Permalink
add test_as_array
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid committed Feb 28, 2025
1 parent 066d30f commit 6ee9b6d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions signature/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,14 @@ mod tests {
Err(ParseSignatureError::WrongSize)
);
}

#[test]
fn test_as_array() {
let bytes = [1u8; 64];
let signature = Signature::from(bytes);
assert_eq!(signature.as_array(), &bytes);
assert_eq!(signature.as_array(), &<Signature as Into<[u8; 64]>>::into(signature));
// Sanity check: ensure the pointer is the same.
assert_eq!(signature.as_array().as_ptr(), signature.0.as_ptr());
}
}

0 comments on commit 6ee9b6d

Please sign in to comment.