mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
Provide the 32-bit variant of the golden tests. Not sure how I forgot to
do this initially, sorry. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151857 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b24b820bd7
commit
9731294171
@ -161,6 +161,7 @@ TEST(HashingTest, HashCombineRangeLengthDiff) {
|
||||
|
||||
TEST(HashingTest, HashCombineRangeGoldenTest) {
|
||||
struct { const char *s; uint64_t hash; } golden_data[] = {
|
||||
#if SIZE_MAX == UINT64_MAX
|
||||
{ "a", 0xaeb6f9d5517c61f8ULL },
|
||||
{ "ab", 0x7ab1edb96be496b4ULL },
|
||||
{ "abc", 0xe38e60bf19c71a3fULL },
|
||||
@ -212,14 +213,70 @@ TEST(HashingTest, HashCombineRangeGoldenTest) {
|
||||
"abababababababababababababababab"
|
||||
"abababababababababababababababab"
|
||||
"abababababababababababababababab", 0x840192d129f7a22bULL }
|
||||
#elif SIZE_MAX == UINT32_MAX
|
||||
{ "a", 0x000000004605f745ULL },
|
||||
{ "ab", 0x00000000d5f06301ULL },
|
||||
{ "abc", 0x00000000559fe1eeULL },
|
||||
{ "abcde", 0x00000000424028d7ULL },
|
||||
{ "abcdefgh", 0x000000007bb119f8ULL },
|
||||
{ "abcdefghijklm", 0x00000000edbca513ULL },
|
||||
{ "abcdefghijklmnopqrstu", 0x000000007c15712eULL },
|
||||
{ "abcdefghijklmnopqrstuvwxyzabcdef", 0x000000000b3aad66ULL },
|
||||
{ "abcdefghijklmnopqrstuvwxyzabcdef"
|
||||
"abcdefghijklmnopqrstuvwxyzghijkl"
|
||||
"abcdefghijklmnopqrstuvwxyzmnopqr"
|
||||
"abcdefghijklmnopqrstuvwxyzstuvwx"
|
||||
"abcdefghijklmnopqrstuvwxyzyzabcd", 0x000000008c758c8bULL },
|
||||
{ "a", 0x000000004605f745ULL },
|
||||
{ "aa", 0x00000000dc0a52daULL },
|
||||
{ "aaa", 0x00000000b309274fULL },
|
||||
{ "aaaaa", 0x00000000203b5ef6ULL },
|
||||
{ "aaaaaaaa", 0x00000000a429e18fULL },
|
||||
{ "aaaaaaaaaaaaa", 0x000000008662070bULL },
|
||||
{ "aaaaaaaaaaaaaaaaaaaaa", 0x000000003f11151cULL },
|
||||
{ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0x000000008600fe20ULL },
|
||||
{ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0x000000004e0e0804ULL },
|
||||
{ "z", 0x00000000c5e405e9ULL },
|
||||
{ "zz", 0x00000000a8d8a2c6ULL },
|
||||
{ "zzz", 0x00000000fc2af672ULL },
|
||||
{ "zzzzz", 0x0000000047d9efe6ULL },
|
||||
{ "zzzzzzzz", 0x0000000080d77794ULL },
|
||||
{ "zzzzzzzzzzzzz", 0x00000000405f93adULL },
|
||||
{ "zzzzzzzzzzzzzzzzzzzzz", 0x00000000fc72838dULL },
|
||||
{ "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz", 0x000000007ce160f1ULL },
|
||||
{ "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
|
||||
"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
|
||||
"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
|
||||
"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
|
||||
"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz", 0x00000000aed9ed1bULL },
|
||||
{ "a", 0x000000004605f745ULL },
|
||||
{ "ab", 0x00000000d5f06301ULL },
|
||||
{ "aba", 0x00000000a85cd91bULL },
|
||||
{ "ababa", 0x000000009e3bb52eULL },
|
||||
{ "abababab", 0x000000002709b3b9ULL },
|
||||
{ "ababababababa", 0x000000003a234174ULL },
|
||||
{ "ababababababababababa", 0x000000005c63e5ceULL },
|
||||
{ "abababababababababababababababab", 0x0000000013f74334ULL },
|
||||
{ "abababababababababababababababab"
|
||||
"abababababababababababababababab"
|
||||
"abababababababababababababababab"
|
||||
"abababababababababababababababab"
|
||||
"abababababababababababababababab", 0x00000000c1a6f135ULL },
|
||||
#else
|
||||
#error This test only supports 64-bit and 32-bit systems.
|
||||
#endif
|
||||
};
|
||||
for (unsigned i = 0; i < sizeof(golden_data)/sizeof(*golden_data); ++i) {
|
||||
StringRef str = golden_data[i].s;
|
||||
hash_code hash = hash_combine_range(str.begin(), str.end());
|
||||
#if 0 // Enable this to generate paste-able text for the above structure.
|
||||
#if 1 // Enable this to generate paste-able text for the above structure.
|
||||
std::string member_str = "\"" + str.str() + "\",";
|
||||
fprintf(stderr, " { %-35s 0x%016lxULL },\n",
|
||||
member_str.c_str(), (size_t)hash);
|
||||
fprintf(stderr, " { %-35s 0x%016llxULL },\n",
|
||||
member_str.c_str(), static_cast<uint64_t>(hash));
|
||||
#endif
|
||||
EXPECT_EQ(static_cast<size_t>(golden_data[i].hash),
|
||||
static_cast<size_t>(hash));
|
||||
|
Loading…
x
Reference in New Issue
Block a user