#[cfg(test)]
mod tests {

    use crate::utils::u8arr_to_hex;

    const M3: &str = "abc";
    const M512: &str = "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd";

    #[test]
    fn hmac_sm3() {
        use crate::hmac_sm3::HmacSm3;

        let mut hmac_sm3 = HmacSm3::new(M3.as_bytes());
        hmac_sm3.update(M3.as_bytes());
        let hmac_sm3_result = hmac_sm3.digest();
        assert_eq!(hmac_sm3_result, [129, 18, 210, 74, 9, 238, 218, 67, 234, 89, 95, 60, 254, 251, 42, 52, 133, 105, 119, 206, 74, 193, 208, 63, 204, 32, 103, 174, 100, 197, 227, 241]);
        println!("hmac_sm3_result: {:?}", hmac_sm3_result);
        let hmac_sm3_result_hex = u8arr_to_hex(hmac_sm3_result);
        assert_eq!(hmac_sm3_result_hex, "8112d24a09eeda43ea595f3cfefb2a34856977ce4ac1d03fcc2067ae64c5e3f1");
        println!("hmac_sm3_result_hex: {:?}", hmac_sm3_result_hex);

        let mut hmac_sm3 = HmacSm3::new(M512.as_bytes());
        hmac_sm3.update(M512.as_bytes());
        let hmac_sm3_result = hmac_sm3.digest();
        assert_eq!(hmac_sm3_result, [220, 54, 122, 224, 123, 151, 172, 158, 180, 229, 118, 45, 91, 133, 224, 26, 133, 139, 9, 19, 146, 54, 90, 145, 60, 193, 122, 96, 163, 228, 121, 200]);
        println!("hmac_sm3_result: {:?}", hmac_sm3_result);
        let hmac_sm3_result_hex = u8arr_to_hex(hmac_sm3_result);
        assert_eq!(hmac_sm3_result_hex, "dc367ae07b97ac9eb4e5762d5b85e01a858b091392365a913cc17a60a3e479c8");
        println!("hmac_sm3_result_hex: {:?}", hmac_sm3_result_hex);
    }
}
