split nihav-codec-support crate from nihav-core
[nihav.git] / nihav-codec-support / src / test / mod.rs
1 //! Decoder testing functionality.
2 //!
3 //! This module provides functions that may be used in internal test to check that decoders produce output and that they produce expected output.
4 pub mod dec_video;
5 pub mod wavwriter;
6
7 mod md5; // for internal checksums only
8
9 /// Decoder testing modes.
10 ///
11 /// NihAV has its own MD5 hasher that calculates hash for input frame in a deterministic way (i.e. no endianness issues) and it outputs hash as `[u32; 4]`. During testing the resulting hash will be printed out so when the test fails you can find what was the calculated hash (and use it as a reference if you are implementing a new test).
12 pub enum ExpectedTestResult {
13 /// Decoding runs without errors.
14 Decodes,
15 /// Full decoded output is expected to be equal to this MD5 hash.
16 MD5([u32; 4]),
17 /// Each decoded frame hash should be equal to the corresponding MD5 hash.
18 MD5Frames(Vec<[u32; 4]>),
19 /// Test function should report decoded frame hashes to be used as the reference later.
20 GenerateMD5Frames,
21 }