diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-07-22 16:41:52 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-07-22 17:02:34 +0200 |
commit | 21014f3be3e4f8ebf34243f4f10841f0fb0b3843 (patch) | |
tree | 1208031cead9f9ca78d0f13a273f8242c045f3fc /test/buildtool/crypto | |
parent | b2f51059cc034f03c70df28a5597a591ed3e5c5d (diff) | |
download | justbuild-21014f3be3e4f8ebf34243f4f10841f0fb0b3843.tar.gz |
Rename HashFunction methods and enums
Diffstat (limited to 'test/buildtool/crypto')
-rw-r--r-- | test/buildtool/crypto/hash_function.test.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/buildtool/crypto/hash_function.test.cpp b/test/buildtool/crypto/hash_function.test.cpp index 209f16a6..61c92eb9 100644 --- a/test/buildtool/crypto/hash_function.test.cpp +++ b/test/buildtool/crypto/hash_function.test.cpp @@ -21,17 +21,17 @@ TEST_CASE("Hash Function", "[crypto]") { std::string bytes{"test"}; - SECTION("Native") { - HashFunction const hash_function{HashFunction::JustHash::Native}; + SECTION("GitSHA1") { + HashFunction const hash_function{HashFunction::Type::GitSHA1}; // same as: echo -n test | sha1sum - CHECK(hash_function.ComputeHash(bytes).HexString() == + CHECK(hash_function.PlainHashData(bytes).HexString() == "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"); // same as: echo -n test | git hash-object --stdin - CHECK(hash_function.ComputeBlobHash(bytes).HexString() == + CHECK(hash_function.HashBlobData(bytes).HexString() == "30d74d258442c7c65512eafab474568dd706c430"); // same as: echo -n test | git hash-object -t "tree" --stdin --literally - CHECK(hash_function.ComputeTreeHash(bytes).HexString() == + CHECK(hash_function.HashTreeData(bytes).HexString() == "5f0ecc1a989593005e80f457446133250fcc43cc"); auto hasher = hash_function.MakeHasher(); @@ -40,18 +40,18 @@ TEST_CASE("Hash Function", "[crypto]") { "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"); } - SECTION("Compatible") { - HashFunction const hash_function{HashFunction::JustHash::Compatible}; + SECTION("PlainSHA256") { + HashFunction const hash_function{HashFunction::Type::PlainSHA256}; // all same as: echo -n test | sha256sum CHECK( - hash_function.ComputeHash(bytes).HexString() == + hash_function.PlainHashData(bytes).HexString() == "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"); CHECK( - hash_function.ComputeBlobHash(bytes).HexString() == + hash_function.HashBlobData(bytes).HexString() == "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"); CHECK( - hash_function.ComputeTreeHash(bytes).HexString() == + hash_function.HashTreeData(bytes).HexString() == "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"); auto hasher = hash_function.MakeHasher(); |