Skip to content

Commit

Permalink
feat(spec): check individual hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
GeopJr committed Nov 12, 2023
1 parent f680c18 commit 332991c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion spec/compare_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ require "../src/collision/functions/file_utils.cr"

describe Collision::FileUtils do
it "returns whether the file contains one of the hashes" do
Collision::FileUtils.compare_content(Path[__DIR__] / "test_content.txt", Collision::CLIPBOARD_HASH.values.to_a).should be_true
Collision::FileUtils.compare_content(Path[__DIR__] / "test_content.txt", Collision::CLIPBOARD_HASH.values).should be_true
end
end
4 changes: 3 additions & 1 deletion spec/hash_generator_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ describe Collision::Checksum do
break if Collision::CLIPBOARD_HASH.size == hashes.size || Time.utc.to_unix_ms - safe_stop > 3000
end

hashes.should eq(Collision::CLIPBOARD_HASH.to_h)
Collision::CLIPBOARD_HASH.each do |k, v|
{k, hashes[k]}.should eq({k, v})
end
end

it "splits strings by 4" do
Expand Down
14 changes: 7 additions & 7 deletions spec/spec_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ module Collision
adler32: "Adler32",
}
CLIPBOARD_HASH = {
md5: "f7e3f382f0382147661c82af20e274e8",
sha1: "c8f0b71214e8164aa69419b7ac0bcd8a74f529a6",
sha256: "08e3dfc089e66c44ae8abd3476b0f810f11f4cfc2ab925f1607c7df21345d639",
sha512: "2ddb9cca7753a01fcbcdbacc228ae8c314ff4e735c6fffb42286272fb460930dc74f122a9f365053a13016b22403ad4e192142e8668bc5f7d6fce865eb38ec2c",
blake3: "8a69892f0946333dbf909ecb68866d2f7116b7ba18ee7f2421afd705f9383cfc",
crc32: "592339ec",
adler32: "1ba80397",
:md5 => "f7e3f382f0382147661c82af20e274e8",
:sha1 => "c8f0b71214e8164aa69419b7ac0bcd8a74f529a6",
:sha256 => "08e3dfc089e66c44ae8abd3476b0f810f11f4cfc2ab925f1607c7df21345d639",
:sha512 => "2ddb9cca7753a01fcbcdbacc228ae8c314ff4e735c6fffb42286272fb460930dc74f122a9f365053a13016b22403ad4e192142e8668bc5f7d6fce865eb38ec2c",
:blake3 => "8a69892f0946333dbf909ecb68866d2f7116b7ba18ee7f2421afd705f9383cfc",
:crc32 => "592339ec",
:adler32 => "1ba80397",
}
end

0 comments on commit 332991c

Please sign in to comment.