make a unittest

master
Bel LaPointe 2023-12-20 09:01:06 -05:00
parent 27562e6599
commit 26f3ccad37
1 changed files with 26 additions and 0 deletions

View File

@ -376,3 +376,29 @@ impl Listener {
stream.pause().unwrap();
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_transcribe_tiny_jfk_wav() {
main(
Flags {
model_path: None,
model_buffer: Some(include_bytes!("../../models/ggml-tiny.en.bin").to_vec()),
threads: 8,
stream_step: 0,
stream_retain: 0.0,
stream_head: 0.0,
stream_tail: 0.0,
wav: Some("../gitea-whisper-rs/sys/whisper.cpp/bindings/go/samples/jfk.wav".to_string()),
debug: false,
},
| result | {
assert!(result.is_ok());
assert_eq!(result.unwrap().to_string(), " And so my fellow Americans ask not what your country can do for you ask what you can do for your country.");
},
);
}
}