Skip to content

Commit

Permalink
hmac: test Debug impls (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Dec 13, 2023
1 parent b802dd5 commit 4607213
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hmac/src/lib.rs
Expand Up @@ -76,7 +76,7 @@
//! the [`Error`][std::error::Error] trait for error types)
//! - `reset`: enables implementation of the [`Reset`][digest::Reset] trait
//! (note that it makes HMAC states bigger)
//!
//!
//! [`digest`]: https://docs.rs/digest
//! [`sha2`]: https://docs.rs/sha2
//! [`RustCrypto/hashes`]: https://github.com/RustCrypto/hashes
Expand Down
11 changes: 10 additions & 1 deletion hmac/tests/mod.rs
Expand Up @@ -2,11 +2,20 @@
use digest::new_mac_test as test;
#[cfg(feature = "reset")]
use digest::new_resettable_mac_test as test;
use hmac::{Hmac, SimpleHmac};
use hmac::{Hmac, HmacCore, SimpleHmac};
use sha1::Sha1;
use sha2::{Sha224, Sha256, Sha384, Sha512};
use streebog::{Streebog256, Streebog512};

#[test]
fn test_debug_impls() {
fn needs_debug<T: std::fmt::Debug>() {}

needs_debug::<Hmac<Sha256>>();
needs_debug::<HmacCore<Sha256>>();
needs_debug::<SimpleHmac<Sha256>>();
}

// Test vectors from RFC 2104, plus wiki test
test!(hmac_md5_rfc2104, "md5", Hmac<md5::Md5>);
test!(hmac_md5_rfc2104_simple, "md5", SimpleHmac<md5::Md5>);
Expand Down

0 comments on commit 4607213

Please sign in to comment.