Skip to content

Commit

Permalink
Add regression tests for #42
Browse files Browse the repository at this point in the history
Closes #42

Sample 15 is commented out because right now it seems
to create an allocator error.
  • Loading branch information
est31 committed Feb 26, 2019
1 parent 489948d commit 0d13bc4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
28 changes: 26 additions & 2 deletions dev/cmp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ pub fn get_xiph_asset_defs_5() -> [TestAssetDef; 5] {
/// The test files are licensed under CC-0:
/// * https://github.com/RustAudio/lewton/issues/33#issuecomment-419640709
/// * http://web.archive.org/web/20180910135020/https://github.com/RustAudio/lewton/issues/33
pub fn get_fuzzed_asset_defs() -> [TestAssetDef; 4] {
pub fn get_fuzzed_asset_defs() -> [TestAssetDef; 9] {
return [
TestAssetDef {
filename : format!("27_really_minimized_testcase_crcfix.ogg"),
Expand All @@ -634,6 +634,30 @@ pub fn get_fuzzed_asset_defs() -> [TestAssetDef; 4] {
hash : format!("2f202e71ca0440a2de4a15443beae9d3230e81e47bc01d29929fc86ee731887c"),
url : format!("https://github.com/RustAudio/lewton/files/2889595/35_where-did-my-memory-go-repacked.ogg.zip"),
},

TestAssetDef {
filename : format!("bug-42-sample009.ogg"),
hash : format!("7e3d7fd6d306cd1c1704d0586b4e62cc897c499e3ffc1911f62ec0fc3a062871"),
url : format!("https://github.com/RustAudio/lewton/files/2905014/bug-42-sample009.ogg.zip"),
},
TestAssetDef {
filename : format!("bug-42-sample012.ogg"),
hash : format!("8d92c4359bbe987b77459f309859b6bba0a11724e71fd5e81873c597ec71d857"),
url : format!("https://github.com/RustAudio/lewton/files/2905017/bug-42-sample012.ogg.zip"),
},
TestAssetDef {
filename : format!("bug-42-sample015.ogg"),
hash : format!("274c17222d7cfc1044d2fee3e60377eac87f5ee8d952eeaf3d636b016b1db7d3"),
url : format!("https://github.com/RustAudio/lewton/files/2905018/bug-42-sample015.ogg.zip"),
},
TestAssetDef {
filename : format!("bug-42-sample016.ogg"),
hash : format!("ab02fd55a275b1ec0c6c56a667834231bf34b3a79038f43196d1015c1555e535"),
url : format!("https://github.com/RustAudio/lewton/files/2905019/bug-42-sample016.ogg.zip"),
},
TestAssetDef {
filename : format!("bug-42-sample029.ogg"),
hash : format!("1436fff4d8fa61ff2b22ffd021c2bd80f072556b8b58cfc72fdfc0434efd9a24"),
url : format!("https://github.com/RustAudio/lewton/files/2905020/bug-42-sample029.ogg.zip"),
},
];
}
6 changes: 6 additions & 0 deletions dev/cmp/tests/fuzzed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ fn test_malformed_fuzzed() {
ensure_malformed!("27_really_minimized_testcase_crcfix.ogg", BadAudio(AudioBadFormat));
ensure_malformed!("32_minimized_crash_testcase.ogg", BadHeader(HeaderBadFormat));
ensure_malformed!("35_where_did_my_memory_go_repacked.ogg", BadHeader(HeaderBadFormat));

ensure_malformed!("bug-42-sample009.ogg", BadAudio(AudioBadFormat));
ensure_malformed!("bug-42-sample012.ogg", BadAudio(AudioBadFormat));
//ensure_malformed!("bug-42-sample015.ogg", BadAudio(AudioBadFormat));
}

#[test]
Expand All @@ -35,4 +39,6 @@ fn test_okay_fuzzed() {
println!();

ensure_okay!("33_minimized_panic_testcase.ogg");
ensure_okay!("bug-42-sample016.ogg");
ensure_okay!("bug-42-sample029.ogg");
}

0 comments on commit 0d13bc4

Please sign in to comment.