Test 2/2
This commit is contained in:
@ -59,7 +59,7 @@ IAT_BEGIN_BLOCK(Core, Utils)
|
||||
// B. Hex To Binary (Valid Upper)
|
||||
auto resUpper = IACore::Utils::HexStringToBinary("DEADBEEF00FF");
|
||||
IAT_CHECK(resUpper.has_value());
|
||||
IAT_CHECK_EQ(resUpper->size(), 6);
|
||||
IAT_CHECK_EQ(resUpper->size(), (SIZE_T)6);
|
||||
IAT_CHECK_EQ((*resUpper)[0], 0xDE);
|
||||
IAT_CHECK_EQ((*resUpper)[5], 0xFF);
|
||||
|
||||
@ -189,11 +189,24 @@ IAT_BEGIN_BLOCK(Core, Utils)
|
||||
IAT_CHECK_EQ(h1, h2); // Same content = same hash
|
||||
IAT_CHECK_NEQ(h1, h3); // Different content = different hash
|
||||
|
||||
// Verify it works with ComputeHash when passed as object
|
||||
// (Assuming you extend ComputeHash to handle custom types via the specialized hasher)
|
||||
// Since ComputeHash uses ankerl::unordered_dense::hash<T> internally, this should work:
|
||||
// -------------------------------------------------------------
|
||||
// Verify ComputeHash integration
|
||||
// -------------------------------------------------------------
|
||||
|
||||
// We cannot check EQ(h1, ComputeHash(v1)) because ComputeHash applies
|
||||
// one extra layer of "Golden Ratio Mixing" on top of the object's hash.
|
||||
// Instead, we verify that ComputeHash behaves exactly like a manual HashCombine.
|
||||
|
||||
UINT64 hManual = 0;
|
||||
IACore::Utils::HashCombine(hManual, v1);
|
||||
|
||||
UINT64 hWrapper = IACore::Utils::ComputeHash(v1);
|
||||
IAT_CHECK_EQ(h1, hWrapper);
|
||||
|
||||
// This proves ComputeHash found the specialization and mixed it correctly
|
||||
IAT_CHECK_EQ(hManual, hWrapper);
|
||||
|
||||
// Optional: Verify the avalanche effect took place (hWrapper should NOT be h1)
|
||||
IAT_CHECK_NEQ(h1, hWrapper);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user