mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibCrypto: Avoid needless ByteString usage in unit tests
This commit is contained in:
parent
b5f22b6e90
commit
23b25333a5
Notes:
sideshowbarker
2024-07-17 17:49:11 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/23b25333a5 Pull-request: https://github.com/SerenityOS/serenity/pull/23830 Reviewed-by: https://github.com/shannonbooth ✅
1 changed files with 14 additions and 14 deletions
|
@ -16,11 +16,11 @@ TEST_CASE(test_adler32)
|
|||
EXPECT_EQ(digest, expected_result);
|
||||
};
|
||||
|
||||
do_test(ByteString("").bytes(), 0x1);
|
||||
do_test(ByteString("a").bytes(), 0x00620062);
|
||||
do_test(ByteString("abc").bytes(), 0x024d0127);
|
||||
do_test(ByteString("message digest").bytes(), 0x29750586);
|
||||
do_test(ByteString("abcdefghijklmnopqrstuvwxyz").bytes(), 0x90860b20);
|
||||
do_test(""sv.bytes(), 0x1);
|
||||
do_test("a"sv.bytes(), 0x00620062);
|
||||
do_test("abc"sv.bytes(), 0x024d0127);
|
||||
do_test("message digest"sv.bytes(), 0x29750586);
|
||||
do_test("abcdefghijklmnopqrstuvwxyz"sv.bytes(), 0x90860b20);
|
||||
}
|
||||
|
||||
TEST_CASE(test_cksum)
|
||||
|
@ -30,9 +30,9 @@ TEST_CASE(test_cksum)
|
|||
EXPECT_EQ(digest, expected_result);
|
||||
};
|
||||
|
||||
do_test(ByteString("").bytes(), 0xFFFFFFFF);
|
||||
do_test(ByteString("The quick brown fox jumps over the lazy dog").bytes(), 0x7BAB9CE8);
|
||||
do_test(ByteString("various CRC algorithms input data").bytes(), 0xEFB5CA4F);
|
||||
do_test(""sv.bytes(), 0xFFFFFFFF);
|
||||
do_test("The quick brown fox jumps over the lazy dog"sv.bytes(), 0x7BAB9CE8);
|
||||
do_test("various CRC algorithms input data"sv.bytes(), 0xEFB5CA4F);
|
||||
}
|
||||
|
||||
TEST_CASE(test_cksum_atomic_digest)
|
||||
|
@ -43,10 +43,10 @@ TEST_CASE(test_cksum_atomic_digest)
|
|||
|
||||
Crypto::Checksum::cksum cksum;
|
||||
|
||||
cksum.update(ByteString("Well").bytes());
|
||||
cksum.update(ByteString(" hello ").bytes());
|
||||
cksum.update("Well"sv.bytes());
|
||||
cksum.update(" hello "sv.bytes());
|
||||
cksum.digest();
|
||||
cksum.update(ByteString("friends").bytes());
|
||||
cksum.update("friends"sv.bytes());
|
||||
auto digest = cksum.digest();
|
||||
|
||||
compare(digest, 0x2D65C7E0);
|
||||
|
@ -59,7 +59,7 @@ TEST_CASE(test_crc32)
|
|||
EXPECT_EQ(digest, expected_result);
|
||||
};
|
||||
|
||||
do_test(ByteString("").bytes(), 0x0);
|
||||
do_test(ByteString("The quick brown fox jumps over the lazy dog").bytes(), 0x414FA339);
|
||||
do_test(ByteString("various CRC algorithms input data").bytes(), 0x9BD366AE);
|
||||
do_test(""sv.bytes(), 0x0);
|
||||
do_test("The quick brown fox jumps over the lazy dog"sv.bytes(), 0x414FA339);
|
||||
do_test("various CRC algorithms input data"sv.bytes(), 0x9BD366AE);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue