Sha256: c0afd3fd605231e6c8d583606090be9bf0068ae59d0c5f083c8c9789ea5b4c82
Contents?: true
Size: 742 Bytes
Versions: 4
Compression:
Stored size: 742 Bytes
Contents
require 'phash' { Phash::Audio => '*.mp3', Phash::Image => '**/*.{jpg,png}', Phash::Text => '*.txt', Phash::Video => '*.mp4', }.each do |klass, glob| describe klass do filenames = Dir.glob(File.join(File.dirname(__FILE__), 'data', glob)) klass.for_paths(filenames).combination(2) do |a, b| similar = a.path.split('-')[0] == b.path.split('-')[0] if similar it "finds #{a.path} and #{b.path} similar" do expect(a % b).to be > 0.8 end else it "finds #{a.path} and #{b.path} not similar" do expect(a % b).to be <= 0.5 end end it 'returns same result when switching arguments' do expect(a % b).to eq(b % a) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
pHash-1.2.3 | spec/phash_spec.rb |
pHash-1.2.2 | spec/phash_spec.rb |
pHash-1.2.1 | spec/phash_spec.rb |
pHash-1.2.0 | spec/phash_spec.rb |