Browse Source

Changed product name to pihash for more convienient writing in functions. Updated the unit test to confirm that there are 12 test images

develop
Drew Short 9 years ago
parent
commit
bc229d478a
  1. 19
      src/lib.rs
  2. 4
      src/main.rs

19
src/lib.rs

@ -24,11 +24,24 @@ mod tests {
let paths = fs::read_dir(&path::Path::new("./test_images")).unwrap();
let mut num_paths = 0;
for path in paths {
num_paths += 1;
let orig_path = path.unwrap().path();
let ext = path::Path::new(&orig_path).extension();
match ext {
Some(_) => {
if ext.unwrap() == "jpg" {
println!("Is a image {}: {:?}", num_paths, orig_path) ;
num_paths += 1;
}
},
_ => {
println!("Not an image: {:?}", orig_path) ;
continue
}
}
//println!("Name: {}", path.unwrap().path().display())
}
// Currently 13 files in the test imaages directory
assert!(num_paths >= 13);
// Currently 12 images in the test imaages directory
assert!(num_paths == 12);
}
}

4
src/main.rs

@ -3,10 +3,10 @@
// Licensed under the MIT license<LICENSE-MIT or http://opensource.org/licenses/MIT>.
// This file may not be copied, modified, or distributed except according to those terms.
extern crate perceptual_image_hashing;
extern crate pihash;
fn main() {
let mut string = String::new();
string = perceptual_image_hashing::hello(string);
string = pihash::hello(string);
println!("{}",string);
}
Loading…
Cancel
Save