Skip to content

Commit

Permalink
Add missing result assertion to integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsided committed Oct 20, 2021
1 parent f961999 commit 2542bda
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
name = "stft"
readme = "README.md"
repository = "https://github.com/snd/stft.git"
version = "0.3.0"
version = "0.2.0"
edition = "2018"

[dependencies]
Expand All @@ -19,6 +19,7 @@ strider = "0.1.3"

[dev-dependencies]
criterion = "0.3.4"
approx = "0.5.0"

[[bench]]
name = "lib"
Expand Down
29 changes: 29 additions & 0 deletions tests/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use approx::assert_ulps_eq;
use std::str::FromStr;
use stft::{WindowType, STFT};

Expand Down Expand Up @@ -63,6 +64,14 @@ fn test_stft() {
let mut output: Vec<f64> = vec![0.; 4];
stft.compute_column(&mut output);
println!("{:?}", output);

let expected = vec![
2.7763337740785166,
2.7149781042402594,
2.6218024907053796,
2.647816050270838,
];
assert_ulps_eq!(output.as_slice(), expected.as_slice(), max_ulps = 10);
}

#[test]
Expand All @@ -84,4 +93,24 @@ fn test_stft_padded() {
let mut output: Vec<f64> = vec![0.; 16];
stft.compute_column(&mut output);
println!("{:?}", output);

let expected = vec![
2.7763337740785166,
2.772158781619449,
2.7598791705720664,
2.740299218211912,
2.7149781042402594,
2.686495897766628,
2.6585877421915676,
2.635728083951981,
2.6218024907053796,
2.6183544930578027,
2.6238833073831658,
2.634925941918913,
2.647816050270838,
2.65977332745612,
2.6691025866822033,
2.6749381613735683,
];
assert_ulps_eq!(output.as_slice(), expected.as_slice(), max_ulps = 10);
}

0 comments on commit 2542bda

Please sign in to comment.