hashes: Put test function in a module
With a recent nightly toolchain `clippy` gives us an error: error: missing documentation for a constant I'm not sure why the error is emitted but wrapping the function in a `tests` module as is standard practice clears the error.
This commit is contained in:
parent
4cc14d9df8
commit
6c0aaa0915
|
@ -52,8 +52,12 @@ pub fn fixed_time_eq(a: &[u8], b: &[u8]) -> bool {
|
||||||
unsafe { (::core::ptr::read_volatile(&r) & 1) == 0 }
|
unsafe { (::core::ptr::read_volatile(&r) & 1) == 0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[cfg(test)]
|
||||||
fn eq_test() {
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn eq_test() {
|
||||||
assert!(fixed_time_eq(&[0b00000000], &[0b00000000]));
|
assert!(fixed_time_eq(&[0b00000000], &[0b00000000]));
|
||||||
assert!(fixed_time_eq(&[0b00000001], &[0b00000001]));
|
assert!(fixed_time_eq(&[0b00000001], &[0b00000001]));
|
||||||
assert!(fixed_time_eq(&[0b00000010], &[0b00000010]));
|
assert!(fixed_time_eq(&[0b00000010], &[0b00000010]));
|
||||||
|
@ -87,6 +91,7 @@ fn eq_test() {
|
||||||
assert!(!fixed_time_eq(&[0b00000000, 0b00000001], &[0b00000000, 0b00000000]));
|
assert!(!fixed_time_eq(&[0b00000000, 0b00000001], &[0b00000000, 0b00000000]));
|
||||||
assert!(!fixed_time_eq(&[0b00000000, 0b00000000], &[0b00000001, 0b00000000]));
|
assert!(!fixed_time_eq(&[0b00000000, 0b00000000], &[0b00000001, 0b00000000]));
|
||||||
assert!(!fixed_time_eq(&[0b00000000, 0b00000000], &[0b00000001, 0b00000001]));
|
assert!(!fixed_time_eq(&[0b00000000, 0b00000000], &[0b00000001, 0b00000001]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(bench)]
|
#[cfg(bench)]
|
||||||
|
|
Loading…
Reference in New Issue