mirror of
https://github.com/demostf/cutter.git
synced 2026-06-03 11:54:08 +02:00
snapshot test
This commit is contained in:
parent
cdffdf511a
commit
b164b4621b
3 changed files with 23 additions and 1 deletions
|
|
@ -32,11 +32,13 @@ console_error_panic_hook = { version = "0.1.6", optional = true }
|
|||
#
|
||||
# Unfortunately, `wee_alloc` requires nightly Rust when targeting wasm for now.
|
||||
wee_alloc = { version = "0.4.5", optional = true }
|
||||
pretty_assertions = "1.2.1"
|
||||
clap = { version = "3.1.9", features = ["derive"] }
|
||||
|
||||
[dev-dependencies]
|
||||
wasm-bindgen-test = "0.3.13"
|
||||
expect-test = "1.2.2"
|
||||
pretty_assertions = "1.2.1"
|
||||
md5 = "0.7.0"
|
||||
|
||||
[profile.release]
|
||||
|
||||
|
|
|
|||
1
test_data/gully_cut.md5
Normal file
1
test_data/gully_cut.md5
Normal file
|
|
@ -0,0 +1 @@
|
|||
01a19f4b08fdc92708a1dcae8df340f4
|
||||
19
tests/snapshot.rs
Normal file
19
tests/snapshot.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
use democutter::cut;
|
||||
use expect_test::{expect_file, ExpectFile};
|
||||
use std::fs;
|
||||
|
||||
fn snapshot(path: &str, expect: ExpectFile) {
|
||||
let file = fs::read(path).unwrap();
|
||||
let output = cut(&file, 30000, 50000);
|
||||
let output_md5 = md5::compute(&output);
|
||||
|
||||
expect.assert_eq(&format!("{:x}", output_md5));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn snapshot_gully() {
|
||||
snapshot(
|
||||
"test_data/gully.dem",
|
||||
expect_file!["../test_data/gully_cut.md5"],
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue