From d10c9311ca4aba2e9e22e7771bc68f0637a1ffd9 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 13 Feb 2019 10:56:33 +0100 Subject: [PATCH] add test for missing codec descriptions --- nihav-allstuff/src/lib.rs | 24 ++++++++++++++++++++++++ nihav-core/src/codecs/mod.rs | 3 +++ 2 files changed, 27 insertions(+) diff --git a/nihav-allstuff/src/lib.rs b/nihav-allstuff/src/lib.rs index 7c3ac61..4f712f3 100644 --- a/nihav-allstuff/src/lib.rs +++ b/nihav-allstuff/src/lib.rs @@ -40,3 +40,27 @@ pub fn nihav_register_all_demuxers(rd: &mut RegisteredDemuxers) { rad_register_all_demuxers(rd); realmedia_register_all_demuxers(rd); } + +#[cfg(test)] +mod test { + use super::*; + use nihav_core::register::get_codec_description; + + #[test] + fn test_descriptions() { + let mut rd = RegisteredDecoders::new(); + nihav_register_all_codecs(&mut rd); + let mut has_missing = false; + for dec in rd.iter() { + print!("decoder {} - ", dec.name); + let ret = get_codec_description(dec.name); + if let Some(desc) = ret { + println!("{}", desc); + } else { + println!("missing!"); + has_missing = true; + } + } + assert!(!has_missing); + } +} diff --git a/nihav-core/src/codecs/mod.rs b/nihav-core/src/codecs/mod.rs index 2999cb6..bf4fbd4 100644 --- a/nihav-core/src/codecs/mod.rs +++ b/nihav-core/src/codecs/mod.rs @@ -267,4 +267,7 @@ impl RegisteredDecoders { } None } + pub fn iter(&self) -> std::slice::Iter { + self.decs.iter() + } } -- 2.39.5