Skip to content

Commit

Permalink
Merge pull request #76 from instaclustr/75-fix-intermittent-failure-i…
Browse files Browse the repository at this point in the history
…n-test_read_wavbrro

Issue #75
  • Loading branch information
joshuabvarghese authored Nov 16, 2023
2 parents a1dd95c + be737d2 commit e5aa857
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions wavbrro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ description = "An adaptation of the WAV format for use by the BRRO compressor"
env_logger = "0.10.0"
log = "0.4.0"
rkyv = { version = "0.7.42", features = ["validation"] }
tempfile = "3.2.0"

[dev-dependencies]
env_logger = "0.10.0"
10 changes: 6 additions & 4 deletions wavbrro/src/wavbrro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use rkyv::{Archive, Deserialize, Serialize};
use std::{io, fmt, result, error};
use std::path::Path;


use crate::read::{is_wavbrro_file, read_wavbrro_file};
use crate::write::write_wavbrro_file;

Expand Down Expand Up @@ -224,15 +225,16 @@ mod tests {

#[test]
fn test_write_wavbrro() {
let path = Path::new("test.wbro");
// Create a temporary directory for the test
let temp_dir = tempfile::tempdir().expect("Failed to create temporary directory");
let path = temp_dir.path().join("test.wbro");
let mut wb = WavBrro::new();
wb.add_sample(1.0);
wb.add_sample(2.0);
wb.add_sample(3.0);
wb.to_file(path);
let result = is_wavbrro_file(path);
wb.to_file(&path);
let result = is_wavbrro_file(&path);
assert!(result.unwrap());
std::fs::remove_file(path).expect("Failed to remove temporary file");
}

#[test]
Expand Down

0 comments on commit e5aa857

Please sign in to comment.