From e4b72b2e167b38639d3639331a56faa6ab77eb29 Mon Sep 17 00:00:00 2001 From: Drew Short Date: Fri, 23 Aug 2019 01:54:45 -0500 Subject: [PATCH] Added tests using lib with the cache disabled --- src/lib.rs | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index bd14fc2..b3c806b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -257,6 +257,7 @@ mod tests { ) { let mut hashes: [u64; 3] = [0; 3]; for index in 0..image_paths.len() { +// println!("{}, {:?}", index, image_paths[index]); let image_path = image_paths[index]; let calculated_hash = lib.get_perceptual_hash(&image_path, &hash_precision, &hash_type); println!( @@ -291,6 +292,7 @@ mod tests { fn test_confirm_ahash_results() { // Prep_library let lib = PIHash::new(Some(cache::DEFAULT_CACHE_DIR)); + let no_cache_lib = PIHash::new(None); // Sample_01 tests let sample_01_images: [&Path; 3] = [ @@ -307,6 +309,14 @@ mod tests { sample_01_hashes, &lib, ); + test_imageset_hash( + hash::HashType::AHash, + hash::Precision::Medium, + 0u64, + sample_01_images, + sample_01_hashes, + &no_cache_lib, + ); // Sample_02 tests let sample_02_images: [&Path; 3] = [ @@ -327,6 +337,14 @@ mod tests { sample_02_hashes, &lib, ); + test_imageset_hash( + hash::HashType::AHash, + hash::Precision::Medium, + 0u64, + sample_02_images, + sample_02_hashes, + &no_cache_lib, + ); // Sample_03 tests let sample_03_images: [&Path; 3] = [ @@ -344,6 +362,14 @@ mod tests { sample_03_hashes, &lib, ); + test_imageset_hash( + hash::HashType::AHash, + hash::Precision::Medium, + 0u64, + sample_03_images, + sample_03_hashes, + &no_cache_lib, + ); // Sample_04 tests let sample_04_images: [&Path; 3] = [ @@ -364,6 +390,14 @@ mod tests { sample_04_hashes, &lib, ); + test_imageset_hash( + hash::HashType::AHash, + hash::Precision::Medium, + 0u64, + sample_04_images, + sample_04_hashes, + &no_cache_lib, + ); // Clean_Cache // super::teardown(); @@ -373,6 +407,7 @@ mod tests { fn test_confirm_dhash_results() { // Prep_library let lib = PIHash::new(Some(cache::DEFAULT_CACHE_DIR)); + let no_cache_lib = PIHash::new(None); // Sample_01 tests let sample_01_images: [&Path; 3] = [ @@ -393,6 +428,14 @@ mod tests { sample_01_hashes, &lib, ); + test_imageset_hash( + hash::HashType::DHash, + hash::Precision::Medium, + 0u64, + sample_01_images, + sample_01_hashes, + &no_cache_lib, + ); // Sample_02 tests let sample_02_images: [&Path; 3] = [ @@ -413,6 +456,14 @@ mod tests { sample_02_hashes, &lib, ); + test_imageset_hash( + hash::HashType::DHash, + hash::Precision::Medium, + 0u64, + sample_02_images, + sample_02_hashes, + &no_cache_lib, + ); // Sample_03 tests let sample_03_images: [&Path; 3] = [ @@ -430,6 +481,14 @@ mod tests { sample_03_hashes, &lib, ); + test_imageset_hash( + hash::HashType::DHash, + hash::Precision::Medium, + 0u64, + sample_03_images, + sample_03_hashes, + &no_cache_lib, + ); // Sample_04 tests let sample_04_images: [&Path; 3] = [ @@ -450,6 +509,14 @@ mod tests { sample_04_hashes, &lib, ); + test_imageset_hash( + hash::HashType::DHash, + hash::Precision::Medium, + 0u64, + sample_04_images, + sample_04_hashes, + &no_cache_lib, + ); // Clean_Cache // super::teardown(); @@ -459,6 +526,7 @@ mod tests { fn test_confirm_phash_results() { // Prep_library let lib = PIHash::new(Some(cache::DEFAULT_CACHE_DIR)); + let no_cache_lib = PIHash::new(None); // Sample_01 tests let sample_01_images: [&Path; 3] = [ @@ -475,6 +543,14 @@ mod tests { sample_01_hashes, &lib, ); + test_imageset_hash( + hash::HashType::PHash, + hash::Precision::Medium, + 0u64, + sample_01_images, + sample_01_hashes, + &no_cache_lib, + ); // Sample_02 tests let sample_02_images: [&Path; 3] = [ @@ -495,6 +571,14 @@ mod tests { sample_02_hashes, &lib, ); + test_imageset_hash( + hash::HashType::PHash, + hash::Precision::Medium, + 0u64, + sample_02_images, + sample_02_hashes, + &no_cache_lib, + ); // Sample_03 tests let sample_03_images: [&Path; 3] = [ @@ -515,6 +599,14 @@ mod tests { sample_03_hashes, &lib, ); + test_imageset_hash( + hash::HashType::PHash, + hash::Precision::Medium, + 0u64, + sample_03_images, + sample_03_hashes, + &no_cache_lib, + ); // Sample_04 tests let sample_04_images: [&Path; 3] = [ @@ -535,6 +627,14 @@ mod tests { sample_04_hashes, &lib, ); + test_imageset_hash( + hash::HashType::PHash, + hash::Precision::Medium, + 0u64, + sample_04_images, + sample_04_hashes, + &no_cache_lib, + ); // Clean_Cache // super::teardown();