Skip to content

Commit

Permalink
Small test cleanup
Browse files Browse the repository at this point in the history
The count_instructions crate already calls black_box on the captured
closure arguments.
  • Loading branch information
cesarb committed Jun 11, 2023
1 parent e04b1ea commit b8b503b
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions tests/count_instructions.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
#[cfg(feature = "count_instructions_test")]
mod tests {
use std::hint::black_box;
use std::io::Result;

use constant_time_eq::{constant_time_eq, constant_time_eq_n};
use count_instructions::{count_instructions, Address};

#[inline(never)]
fn count(l: &[u8], r: &[u8], capacity: usize) -> Result<Vec<Address>> {
let l = black_box(l);
let r = black_box(r);
let mut addresses = Vec::with_capacity(capacity);
assert!(!count_instructions(
|| constant_time_eq(l, r),
Expand All @@ -20,8 +17,6 @@ mod tests {

#[inline(never)]
fn count_n<const N: usize>(l: &[u8; N], r: &[u8; N], capacity: usize) -> Result<Vec<Address>> {
let l = black_box(l);
let r = black_box(r);
let mut addresses = Vec::with_capacity(capacity);
assert!(!count_instructions(
|| constant_time_eq_n(l, r),
Expand Down Expand Up @@ -145,8 +140,6 @@ mod tests {

#[inline(never)]
fn count_variable(l: &[u8], r: &[u8], capacity: usize) -> Result<Vec<Address>> {
let l = black_box(l);
let r = black_box(r);
let mut addresses = Vec::with_capacity(capacity);
assert!(!count_instructions(
|| variable_time_eq(l, r),
Expand Down

0 comments on commit b8b503b

Please sign in to comment.