Commit cc2ad997 authored by Patrick Auernig's avatar Patrick Auernig

add some tests for long strings

parent 16b835ff
Pipeline #6477715 failed with stage
in 3 minutes and 26 seconds
......@@ -16,18 +16,21 @@ STRINGS = {
'31d6cfe0d16ae931b73c59d7e0c089c0' => '',
'83ff6980515eb8d749238ec12e54baab' => '.',
'6a49c8fd36b5ebb69c605f44f20c9083' => 'the quick brown fox',
'19c46ea62015d6ed476300c4dd208c67' => 'jumps over the lazy old dog.'
'19c46ea62015d6ed476300c4dd208c67' => 'jumps over the lazy old dog.',
'b64b28984897dca4f27956ecc799c7e5' => ('0123456789' * 971850),
'061519cdd83c3163ef9961484ae89a49' => ('0123456789' * 972800),
'ef16c228530f6fe852051cd0f44126d2' => ('0123456789' * 973750)
}.freeze
describe Digest::ED2K do
TESTFILES.each do |hash, path|
it "hashes file #{path}" do
it "hashes file #{path} of size #{File.size(path)}" do
expect(Digest::ED2K.file(path).hexdigest).to eq(hash)
end
end
STRINGS.each do |hash, str|
it "hashes string '#{str}'" do
it "hashes string '#{str[0..30]}#{'...' if str.size > 30}' of size #{str.size}" do
expect(Digest::ED2K.hexdigest(str)).to eq(hash)
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment