libfreemkv 0.31.4: prune 144 vacuous tests (keep spec-grounded subset)
This commit is contained in:
@@ -548,33 +548,6 @@ mod tests {
|
||||
assert_eq!(codec("dts"), "dts");
|
||||
}
|
||||
|
||||
/// Spec: COMPOUND_LANGS must be ordered longest-first so that
|
||||
/// "Brazilian Portuguese" is matched before bare "Portuguese".
|
||||
/// Mutation: put "portuguese" before "brazilian portuguese" in the table →
|
||||
/// Brazilian Portuguese returns variant="", losing the regional info.
|
||||
#[test]
|
||||
fn compound_lang_longest_match_wins() {
|
||||
let r = lang("Brazilian Portuguese 5.1 Dolby").unwrap();
|
||||
assert_eq!(r.code, "por");
|
||||
assert_eq!(r.variant, "Brazilian");
|
||||
|
||||
let r = lang("Castilian Spanish").unwrap();
|
||||
assert_eq!(r.code, "spa");
|
||||
assert_eq!(r.variant, "Castilian");
|
||||
|
||||
let r = lang("Latin American Spanish").unwrap();
|
||||
assert_eq!(r.code, "spa");
|
||||
assert_eq!(r.variant, "Latin American");
|
||||
}
|
||||
|
||||
/// Spec: bare language name lookup uses word-boundary matching.
|
||||
/// Mutation: use `.contains()` instead of `has_word()` → "engineering" matches "english".
|
||||
#[test]
|
||||
fn lang_no_false_positive_substring() {
|
||||
assert_eq!(lang("Audio Engineering"), None);
|
||||
assert_eq!(lang("Francispeople"), None);
|
||||
}
|
||||
|
||||
/// Spec: all 36 bare-lang entries must resolve correctly.
|
||||
/// Mutation: swap two entries in BARE_LANGS → wrong code returned.
|
||||
#[test]
|
||||
@@ -605,122 +578,6 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
/// Spec: `purpose()` recognizes "commentary" (word-boundary).
|
||||
/// Mutation: use `contains("comment")` → "commenter" wrongly matches.
|
||||
#[test]
|
||||
fn purpose_commentary_word_boundary() {
|
||||
assert_eq!(purpose("English Commentary"), LabelPurpose::Commentary);
|
||||
assert_eq!(purpose("Commenter Track"), LabelPurpose::Normal);
|
||||
assert_eq!(purpose("recommentary"), LabelPurpose::Normal);
|
||||
}
|
||||
|
||||
/// Spec: "Director's Commentary" is a recognized phrase.
|
||||
/// Mutation: require exact "commentary" without apostrophe prefix → fails.
|
||||
#[test]
|
||||
fn purpose_directors_commentary_recognized() {
|
||||
assert_eq!(purpose("Director's Commentary"), LabelPurpose::Commentary);
|
||||
}
|
||||
|
||||
/// Spec: `purpose()` recognizes "audio description" compound phrase.
|
||||
/// Mutation: remove the compound `audio description` check → Descriptive broken.
|
||||
#[test]
|
||||
fn purpose_audio_description_compound() {
|
||||
assert_eq!(purpose("Audio Description"), LabelPurpose::Descriptive);
|
||||
assert_eq!(
|
||||
purpose("English Audio Description"),
|
||||
LabelPurpose::Descriptive
|
||||
);
|
||||
}
|
||||
|
||||
/// Spec: "descriptive service" maps to Descriptive via compound check.
|
||||
/// Mutation: remove "descriptive service" compound → Normal returned.
|
||||
#[test]
|
||||
fn purpose_descriptive_service_compound() {
|
||||
assert_eq!(
|
||||
purpose("English Descriptive Service"),
|
||||
LabelPurpose::Descriptive
|
||||
);
|
||||
}
|
||||
|
||||
/// Spec: "music only" maps to Score via compound check.
|
||||
/// Mutation: remove "music only" compound → Normal returned.
|
||||
#[test]
|
||||
fn purpose_music_only_maps_to_score() {
|
||||
assert_eq!(purpose("Music Only"), LabelPurpose::Score);
|
||||
assert_eq!(purpose("English Music Only Track"), LabelPurpose::Score);
|
||||
}
|
||||
|
||||
/// Spec: "score" (bare word) maps to Score.
|
||||
/// Mutation: remove `has_word(&lower, "score")` check → Normal returned.
|
||||
#[test]
|
||||
fn purpose_score_bare_word() {
|
||||
assert_eq!(purpose("Isolated Score"), LabelPurpose::Score);
|
||||
assert_eq!(purpose("Score Track"), LabelPurpose::Score);
|
||||
}
|
||||
|
||||
/// Spec: "ime" maps to Ime (alternate music track).
|
||||
/// Mutation: remove `has_word(&lower, "ime")` check → Normal returned.
|
||||
#[test]
|
||||
fn purpose_ime_recognized() {
|
||||
assert_eq!(purpose("IME"), LabelPurpose::Ime);
|
||||
assert_eq!(purpose("English ime track"), LabelPurpose::Ime);
|
||||
}
|
||||
|
||||
/// Spec: "ime" inside "time" or "anime" must NOT match.
|
||||
/// Mutation: use `contains("ime")` → "anime", "time" falsely match.
|
||||
#[test]
|
||||
fn purpose_ime_no_substring_match() {
|
||||
assert_eq!(purpose("Showtime Audio"), LabelPurpose::Normal);
|
||||
assert_eq!(purpose("Anime Commentary"), LabelPurpose::Commentary);
|
||||
}
|
||||
|
||||
/// Spec: `qualifier()` prioritizes SDH over Forced when both present.
|
||||
/// Mutation: reverse the SDH check order → Forced returned when both present.
|
||||
#[test]
|
||||
fn qualifier_sdh_priority_over_forced() {
|
||||
assert_eq!(qualifier("English Forced SDH"), LabelQualifier::Sdh);
|
||||
assert_eq!(qualifier("SDH Forced"), LabelQualifier::Sdh);
|
||||
}
|
||||
|
||||
/// Spec: "captions" maps to Sdh (closed-caption subtitles for deaf).
|
||||
/// Mutation: remove `has_word(&lower, "captions")` → "captions" returns None.
|
||||
#[test]
|
||||
fn qualifier_captions_maps_to_sdh() {
|
||||
assert_eq!(qualifier("English Captions"), LabelQualifier::Sdh);
|
||||
assert_eq!(qualifier("Closed Captions"), LabelQualifier::Sdh);
|
||||
}
|
||||
|
||||
/// Spec: "forced narrative" → Forced qualifier.
|
||||
/// Mutation: remove "forced" check → None returned.
|
||||
#[test]
|
||||
fn qualifier_forced_narrative() {
|
||||
assert_eq!(qualifier("Forced Narrative"), LabelQualifier::Forced);
|
||||
assert_eq!(
|
||||
qualifier("English Forced Subtitles"),
|
||||
LabelQualifier::Forced
|
||||
);
|
||||
}
|
||||
|
||||
/// Spec: "rnib" → DescriptiveService qualifier.
|
||||
/// Mutation: remove `has_word(&lower, "rnib")` → None returned.
|
||||
#[test]
|
||||
fn qualifier_rnib_maps_to_descriptive_service() {
|
||||
assert_eq!(
|
||||
qualifier("English RNIB"),
|
||||
LabelQualifier::DescriptiveService
|
||||
);
|
||||
}
|
||||
|
||||
/// Spec: "descriptive service" compound → DescriptiveService.
|
||||
/// Mutation: remove compound check → None returned.
|
||||
#[test]
|
||||
fn qualifier_descriptive_service_compound() {
|
||||
assert_eq!(
|
||||
qualifier("English Descriptive Service"),
|
||||
LabelQualifier::DescriptiveService
|
||||
);
|
||||
}
|
||||
|
||||
/// Word boundary: "sdh" inside "lambdash" must not match.
|
||||
/// Mutation: use `contains("sdh")` → "lambdash" falsely triggers SDH.
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user