[libcxx-commits] [PATCH] D144107: [libc++] Add regression test for std::hash implementation in ABI v1
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Feb 16 11:14:54 PST 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG23d43e697757: [libc++] Add regression test for std::hash implementation in ABI v1 (authored by ldionne).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144107/new/
https://reviews.llvm.org/D144107
Files:
libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.abi-v1.pass.cpp
libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.abi-v2.pass.cpp
libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.pass.cpp
Index: libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.abi-v2.pass.cpp
===================================================================
--- libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.abi-v2.pass.cpp
+++ libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.abi-v2.pass.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
-// Test the CityHash implementation is correct.
-
// UNSUPPORTED: c++03
+// Test that the CityHash implementation is correct.
+//
// In ABI v1, our CityHash implementation is incorrect and fixing it would
// be an ABI break.
// REQUIRES: libcpp-abi-version=2
Index: libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.abi-v1.pass.cpp
===================================================================
--- libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.abi-v1.pass.cpp
+++ libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.abi-v1.pass.cpp
@@ -6,13 +6,14 @@
//
//===----------------------------------------------------------------------===//
-// Test the CityHash implementation is correct.
-
// UNSUPPORTED: c++03
-// In ABI v1, our CityHash implementation is incorrect and fixing it would
-// be an ABI break.
-// REQUIRES: libcpp-abi-version=2
+// Test that the CityHash implementation returns the results we expect.
+//
+// Note that this implementation is technically incorrect, however changing it is
+// an ABI break. This test ensures that we don't unintentionally break the ABI v1
+// by "fixing" the hash implementation.
+// REQUIRES: libcpp-abi-version=1
#include <cassert>
#include <string>
@@ -33,15 +34,16 @@
int main(int, char**) {
const std::pair<std::string, uint64_t> TestCases[] = {
- {CityHash[0], CHOOSE_BY_ENDIANESS(0x4382a8d0fe8edb17ULL, 0xca84e809bef16fbcULL)},
- {CityHash[1], CHOOSE_BY_ENDIANESS(0xecefb080a6854061ULL, 0xd7feb824250272dcULL)},
- {CityHash[2], CHOOSE_BY_ENDIANESS(0x169ea3aebf908d6dULL, 0xea8cef3ca6f6e368ULL)},
- {CityHash[3], CHOOSE_BY_ENDIANESS(0xe18298a2760f09faULL, 0xf33a7700bb7a94a8ULL)},
+ {CityHash[0], CHOOSE_BY_ENDIANESS(0x87c69099911bab7eULL, 0x297621d7fa436a3ULL)},
+ {CityHash[1], CHOOSE_BY_ENDIANESS(0x87c69099911bab7eULL, 0xb17be531dde56e57ULL)},
+ {CityHash[2], CHOOSE_BY_ENDIANESS(0x85322632e188694aULL, 0xe14f578b688e266dULL)},
+ {CityHash[3], CHOOSE_BY_ENDIANESS(0x85322632e188694aULL, 0xca5a764a0450eac6ULL)},
};
std::__murmur2_or_cityhash<uint64_t> h64;
for (const auto& test_case : TestCases) {
assert(h64(test_case.first.data(), test_case.first.size()) == test_case.second);
}
+
return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144107.498092.patch
Type: text/x-patch
Size: 2685 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230216/541eb151/attachment.bin>
More information about the libcxx-commits
mailing list