mirror of
https://github.com/RustAudio/rodio
synced 2025-03-02 14:07:15 +00:00
Upgrade quickcheck, make tests more reliable
This commit is contained in:
parent
d2a5085404
commit
574b809549
2 changed files with 6 additions and 5 deletions
|
@ -47,7 +47,7 @@ symphonia-alac = ["symphonia/isomp4", "symphonia/alac"]
|
|||
symphonia-aiff = ["symphonia/aiff", "symphonia/pcm"]
|
||||
|
||||
[dev-dependencies]
|
||||
quickcheck = "0.9.2"
|
||||
quickcheck = "1.0.3"
|
||||
rstest = "0.18.2"
|
||||
rstest_reuse = "0.6.0"
|
||||
approx = "0.5.1"
|
||||
|
|
|
@ -50,6 +50,7 @@ where
|
|||
let from = from.0;
|
||||
let to = to.0;
|
||||
|
||||
assert!(num_channels >= 1);
|
||||
assert!(from >= 1);
|
||||
assert!(to >= 1);
|
||||
|
||||
|
@ -262,9 +263,9 @@ mod test {
|
|||
quickcheck! {
|
||||
/// Check that resampling an empty input produces no output.
|
||||
fn empty(from: u32, to: u32, n: u16) -> () {
|
||||
if n == 0 { return; }
|
||||
let from = if from == 0 { return; } else { SampleRate(from) };
|
||||
let to = if to == 0 { return; } else { SampleRate(to) };
|
||||
if n == 0 { return; }
|
||||
|
||||
let input: Vec<u16> = Vec::new();
|
||||
let output =
|
||||
|
@ -276,8 +277,8 @@ mod test {
|
|||
|
||||
/// Check that resampling to the same rate does not change the signal.
|
||||
fn identity(from: u32, n: u16, input: Vec<u16>) -> () {
|
||||
let from = if from == 0 { return; } else { SampleRate(from) };
|
||||
if n == 0 { return; }
|
||||
let from = if from == 0 { return; } else { SampleRate(from) };
|
||||
|
||||
let output =
|
||||
SampleRateConverter::new(input.clone().into_iter(), from, from, n)
|
||||
|
@ -289,9 +290,9 @@ mod test {
|
|||
/// Check that dividing the sample rate by k (integer) is the same as
|
||||
/// dropping a sample from each channel.
|
||||
fn divide_sample_rate(to: u32, k: u32, input: Vec<u16>, n: u16) -> () {
|
||||
if k == 0 || n == 0 || to.checked_mul(k).is_none() { return; }
|
||||
let to = if to == 0 { return; } else { SampleRate(to) };
|
||||
let from = to * k;
|
||||
if k == 0 || n == 0 { return; }
|
||||
|
||||
// Truncate the input, so it contains an integer number of frames.
|
||||
let input = {
|
||||
|
@ -313,9 +314,9 @@ mod test {
|
|||
/// Check that, after multiplying the sample rate by k, every k-th
|
||||
/// sample in the output matches exactly with the input.
|
||||
fn multiply_sample_rate(from: u32, k: u32, input: Vec<u16>, n: u16) -> () {
|
||||
if k == 0 || n == 0 || from.checked_mul(k).is_none() { return; }
|
||||
let from = if from == 0 { return; } else { SampleRate(from) };
|
||||
let to = from * k;
|
||||
if k == 0 || n == 0 { return; }
|
||||
|
||||
// Truncate the input, so it contains an integer number of frames.
|
||||
let input = {
|
||||
|
|
Loading…
Add table
Reference in a new issue