mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-12 11:13:55 +00:00
Tests only; each was confirmed to fail on a mutated encoder. - Every sample rate code in the frame header table. - Signals that reach the Rice parameter and LPC shift limits, where a value past the limit gives a file decoders refuse. - ENCODE_EXTENSIONS lists flac. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
959 B
Rust
21 lines
959 B
Rust
use craft_audio::{EncodeFormat, encode_format_for};
|
|
|
|
#[test]
|
|
fn only_formats_the_encoder_writes_are_named() {
|
|
assert_eq!(encode_format_for("wav"), Some(EncodeFormat::Wav));
|
|
assert_eq!(encode_format_for("WAV"), Some(EncodeFormat::Wav));
|
|
assert_eq!(encode_format_for(".aif"), Some(EncodeFormat::Aiff));
|
|
assert_eq!(encode_format_for("aiff"), Some(EncodeFormat::Aiff));
|
|
assert_eq!(encode_format_for("wave"), Some(EncodeFormat::Wav));
|
|
assert_eq!(encode_format_for("BWF"), Some(EncodeFormat::Wav));
|
|
assert_eq!(encode_format_for(".aifc"), Some(EncodeFormat::Aiff));
|
|
assert_eq!(encode_format_for("flac"), Some(EncodeFormat::Flac));
|
|
assert!(craft_audio::ENCODE_EXTENSIONS.contains(&"flac"));
|
|
for name in craft_audio::ENCODE_EXTENSIONS {
|
|
assert!(encode_format_for(name).is_some(), "{name}");
|
|
}
|
|
for other in ["mp3", "ogg", "m4a", "xyz", ""] {
|
|
assert_eq!(encode_format_for(other), None, "{other}");
|
|
}
|
|
}
|