Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit 0c29aed

Browse files
committed
Remove fuzzy float checks, remove test_util module
1 parent 788741f commit 0c29aed

File tree

3 files changed

+16
-27
lines changed

3 files changed

+16
-27
lines changed

src/buffer.rs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,6 @@ impl SendEventBuffer {
481481
#[cfg(test)]
482482
mod tests {
483483
use buffer::AudioBuffer;
484-
use util::test_util;
485484

486485
/// Size of buffers used in tests.
487486
const SIZE: usize = 1024;
@@ -494,6 +493,7 @@ mod tests {
494493
/// and the output channels are just 0.
495494
/// This test assures that when the buffers are zipped together,
496495
/// the input values do not change.
496+
#[allow(clippy::float_cmp)]
497497
#[test]
498498
fn buffer_zip() {
499499
let in1: Vec<f32> = (0..SIZE).map(|x| x as f32).collect();
@@ -508,15 +508,16 @@ mod tests {
508508

509509
for (input, output) in buffer.zip() {
510510
input.iter().zip(output.iter_mut()).fold(0, |acc, (input, output)| {
511-
test_util::assert_f32_equal(*input, acc as f32);
512-
test_util::assert_f32_zero(*output);
511+
assert_eq!(*input, acc as f32);
512+
assert_eq!(*output, 0.0);
513513
acc + 1
514514
});
515515
}
516516
}
517517

518518
// Test that the `zip()` method returns an iterator that gives `n` elements
519519
// where n is the number of inputs when this is lower than the number of outputs.
520+
#[allow(clippy::float_cmp)]
520521
#[test]
521522
fn buffer_zip_fewer_inputs_than_outputs() {
522523
let in1 = vec![1.0; SIZE];
@@ -532,15 +533,15 @@ mod tests {
532533

533534
let mut iter = buffer.zip();
534535
if let Some((observed_in1, observed_out1)) = iter.next() {
535-
test_util::assert_f32_equal(observed_in1[0], 1.0);
536-
test_util::assert_f32_equal(observed_out1[0], 3.0);
536+
assert_eq!(1.0, observed_in1[0]);
537+
assert_eq!(3.0, observed_out1[0]);
537538
} else {
538539
unreachable!();
539540
}
540541

541542
if let Some((observed_in2, observed_out2)) = iter.next() {
542-
test_util::assert_f32_equal(observed_in2[0], 2.0);
543-
test_util::assert_f32_equal(observed_out2[0], 4.0);
543+
assert_eq!(2.0, observed_in2[0]);
544+
assert_eq!(4.0, observed_out2[0]);
544545
} else {
545546
unreachable!();
546547
}
@@ -550,6 +551,7 @@ mod tests {
550551

551552
// Test that the `zip()` method returns an iterator that gives `n` elements
552553
// where n is the number of outputs when this is lower than the number of inputs.
554+
#[allow(clippy::float_cmp)]
553555
#[test]
554556
fn buffer_zip_more_inputs_than_outputs() {
555557
let in1 = vec![1.0; SIZE];
@@ -566,15 +568,15 @@ mod tests {
566568
let mut iter = buffer.zip();
567569

568570
if let Some((observed_in1, observed_out1)) = iter.next() {
569-
test_util::assert_f32_equal(observed_in1[0], 1.0);
570-
test_util::assert_f32_equal(observed_out1[0], 4.0);
571+
assert_eq!(1.0, observed_in1[0]);
572+
assert_eq!(4.0, observed_out1[0]);
571573
} else {
572574
unreachable!();
573575
}
574576

575577
if let Some((observed_in2, observed_out2)) = iter.next() {
576-
test_util::assert_f32_equal(observed_in2[0], 2.0);
577-
test_util::assert_f32_equal(observed_out2[0], 5.0);
578+
assert_eq!(2.0, observed_in2[0]);
579+
assert_eq!(5.0, observed_out2[0]);
578580
} else {
579581
unreachable!();
580582
}
@@ -583,6 +585,7 @@ mod tests {
583585
}
584586

585587
/// Test that creating buffers from raw pointers works.
588+
#[allow(clippy::float_cmp)]
586589
#[test]
587590
fn from_raw() {
588591
let in1: Vec<f32> = (0..SIZE).map(|x| x as f32).collect();
@@ -597,8 +600,8 @@ mod tests {
597600

598601
for (input, output) in buffer.zip() {
599602
input.iter().zip(output.iter_mut()).fold(0, |acc, (input, output)| {
600-
test_util::assert_f32_equal(*input, acc as f32);
601-
test_util::assert_f32_zero(*output);
603+
assert_eq!(*input, acc as f32);
604+
assert_eq!(*output, 0.0);
602605
acc + 1
603606
});
604607
}

src/util/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
mod atomic_float;
44
mod parameter_transfer;
5-
pub mod test_util;
65

76
pub use self::atomic_float::AtomicFloat;
87
pub use self::parameter_transfer::{ParameterTransfer, ParameterTransferIterator};

src/util/test_util.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)