Commit e96aa455 authored by Nathan Bronson's avatar Nathan Bronson Committed by Facebook Github Bot

fix test on 32-bit platforms

Summary:
Folly hasher for integers is avalanching on 32-bit platforms,
which is properly handled by the associated traits.  This diff fixes
the unit tests to match.

Reviewed By: yfeldblum

Differential Revision: D8584675

fbshipit-source-id: 5895b2ad8d82afdef2bf277819bb6e3fff56d99a
parent 5e03c4db
......@@ -628,6 +628,8 @@ INSTANTIATE_TEST_CASE_P(
//////// static checks
static constexpr bool k32Bit = sizeof(std::size_t) == 4;
static_assert(!folly::IsAvalanchingHasher<std::hash<int>, int>::value, "");
static_assert(
!folly::IsAvalanchingHasher<std::hash<char const*>, char const*>::value,
......@@ -675,38 +677,57 @@ static_assert(
std::tuple<int, int, int>>::value,
"");
static_assert(!folly::IsAvalanchingHasher<folly::Hash, uint8_t>::value, "");
static_assert(!folly::IsAvalanchingHasher<folly::Hash, char>::value, "");
static_assert(!folly::IsAvalanchingHasher<folly::Hash, uint16_t>::value, "");
static_assert(!folly::IsAvalanchingHasher<folly::Hash, int16_t>::value, "");
static_assert(!folly::IsAvalanchingHasher<folly::Hash, uint32_t>::value, "");
static_assert(!folly::IsAvalanchingHasher<folly::Hash, int32_t>::value, "");
static_assert(
k32Bit == folly::IsAvalanchingHasher<folly::Hash, uint8_t>::value,
"");
static_assert(
k32Bit == folly::IsAvalanchingHasher<folly::Hash, char>::value,
"");
static_assert(
k32Bit == folly::IsAvalanchingHasher<folly::Hash, uint16_t>::value,
"");
static_assert(
k32Bit == folly::IsAvalanchingHasher<folly::Hash, int16_t>::value,
"");
static_assert(
k32Bit == folly::IsAvalanchingHasher<folly::Hash, uint32_t>::value,
"");
static_assert(
k32Bit == folly::IsAvalanchingHasher<folly::Hash, int32_t>::value,
"");
static_assert(folly::IsAvalanchingHasher<folly::Hash, uint64_t>::value, "");
static_assert(folly::IsAvalanchingHasher<folly::Hash, int64_t>::value, "");
static_assert(
folly::IsAvalanchingHasher<folly::Hash, folly::StringPiece>::value,
"");
static_assert(folly::IsAvalanchingHasher<folly::Hash, std::string>::value, "");
static_assert(!folly::IsAvalanchingHasher<folly::Hash, TestEnum>::value, "");
static_assert(
k32Bit == folly::IsAvalanchingHasher<folly::Hash, TestEnum>::value,
"");
static_assert(folly::IsAvalanchingHasher<folly::Hash, TestBigEnum>::value, "");
static_assert(
!folly::IsAvalanchingHasher<folly::hasher<uint8_t>, uint8_t>::value,
k32Bit ==
folly::IsAvalanchingHasher<folly::hasher<uint8_t>, uint8_t>::value,
"");
static_assert(
!folly::IsAvalanchingHasher<folly::hasher<char>, char>::value,
k32Bit == folly::IsAvalanchingHasher<folly::hasher<char>, char>::value,
"");
static_assert(
!folly::IsAvalanchingHasher<folly::hasher<uint16_t>, uint16_t>::value,
k32Bit ==
folly::IsAvalanchingHasher<folly::hasher<uint16_t>, uint16_t>::value,
"");
static_assert(
!folly::IsAvalanchingHasher<folly::hasher<int16_t>, int16_t>::value,
k32Bit ==
folly::IsAvalanchingHasher<folly::hasher<int16_t>, int16_t>::value,
"");
static_assert(
!folly::IsAvalanchingHasher<folly::hasher<uint32_t>, uint32_t>::value,
k32Bit ==
folly::IsAvalanchingHasher<folly::hasher<uint32_t>, uint32_t>::value,
"");
static_assert(
!folly::IsAvalanchingHasher<folly::hasher<int32_t>, int32_t>::value,
k32Bit ==
folly::IsAvalanchingHasher<folly::hasher<int32_t>, int32_t>::value,
"");
static_assert(
folly::IsAvalanchingHasher<folly::hasher<uint64_t>, uint64_t>::value,
......@@ -737,7 +758,8 @@ static_assert(
std::pair<int, int>>::value,
"");
static_assert(
!folly::IsAvalanchingHasher<
k32Bit ==
folly::IsAvalanchingHasher<
folly::hasher<std::tuple<int>>,
std::tuple<int>>::value,
"");
......@@ -757,7 +779,8 @@ static_assert(
std::tuple<int, int, int>>::value,
"");
static_assert(
!folly::IsAvalanchingHasher<folly::hasher<TestEnum>, TestEnum>::value,
k32Bit ==
folly::IsAvalanchingHasher<folly::hasher<TestEnum>, TestEnum>::value,
"");
static_assert(
folly::IsAvalanchingHasher<folly::hasher<TestBigEnum>, TestBigEnum>::value,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment