require 'helper' class TestDupeMagick < Test::Unit::TestCase should "compare two identical images and return a euclidian distance of 0" do comparison = DupeMagick.new path = File.expand_path(File.dirname(__FILE__)) assert_equal 0, comparison.compare_images( path + "/" + "images/first_wife.png", path + "/" + "images/second_wife.jpg", { :geometry => '8x8!' } ) end should "compare two possibly similar images and return a euclidian distance of 104" do comparison = DupeMagick.new path = File.expand_path(File.dirname(__FILE__)) assert_equal 104, comparison.compare_images( path + "/" + "images/first_wife.png", path + "/" + "images/bright_wife.png", { :geometry => '8x8!' } ) end should "compare two different images and return a euclidian distance of 531" do comparison = DupeMagick.new path = File.expand_path(File.dirname(__FILE__)) assert_equal 531, comparison.compare_images( path + "/" + "images/first_wife.png", path + "/" + "images/different.jpg", { :geometry => '8x8!' } ) end should "parse a file path" do comparison = DupeMagick.new path = File.expand_path(File.dirname(__FILE__)) comparison.find_duplicates(path + "/" + "images/first_wife.png", path + "/" + "images/*") end end