cleanup some test failures.

This commit is contained in:
greg
2020-07-19 17:51:13 -04:00
parent b47713c2c2
commit 37b04503db
6 changed files with 43 additions and 27 deletions
+5 -2
View File
@@ -15,6 +15,7 @@
#ifndef THIS_HASH_MAP
#define THIS_HASH_MAP flat_hash_map
#define THIS_TEST_NAME FlatHashMap
#define ORIG_FLAT_HASH_MAP 1
#endif
#ifndef THIS_EXTRA_TPL_PARAMS
@@ -198,14 +199,16 @@ TEST(THIS_TEST_NAME, LazyKeyPattern) {
m.try_emplace(LazyInt(2, &conversions), 3);
EXPECT_THAT(m, UnorderedElementsAre(Pair(1, 2), Pair(2, 3)));
EXPECT_EQ(conversions, 2);
#ifdef NDEBUG
#if defined(NDEBUG) && ORIG_FLAT_HASH_MAP
// for parallel maps, the reserve(3) above is not sufficient to guarantee that a submap will not resize and therefore rehash
EXPECT_EQ(hashes, 3);
#endif
m.try_emplace(LazyInt(2, &conversions), 4);
EXPECT_THAT(m, UnorderedElementsAre(Pair(1, 2), Pair(2, 3)));
EXPECT_EQ(conversions, 2);
#ifdef NDEBUG
#if defined(NDEBUG) && ORIG_FLAT_HASH_MAP
// for parallel maps, the reserve(3) above is not sufficient to guarantee that a submap will not resize and therefore rehash
EXPECT_EQ(hashes, 4);
#endif
}
+5 -8
View File
@@ -1112,8 +1112,7 @@ ExpectedStats XorSeedExpectedStats() {
// The effective load factor is larger in non-opt mode because we insert
// elements out of order.
switch (container_internal::Group::kWidth) {
case 8:
PHMAP_IF_CONSTEXPR (container_internal::Group::kWidth == 8) {
if (kRandomizesInserts) {
return {0.05,
1.0,
@@ -1125,8 +1124,8 @@ ExpectedStats XorSeedExpectedStats() {
{{0.95, 0.1}},
{{0.95, 0}, {0.99, 2}, {0.999, 4}, {0.9999, 10}}};
}
case 16:
default:
}
else {
if (kRandomizesInserts) {
return {0.1,
1.0,
@@ -1217,8 +1216,7 @@ ExpectedStats LinearTransformExpectedStats() {
// The effective load factor is larger in non-opt mode because we insert
// elements out of order.
switch (container_internal::Group::kWidth) {
case 8:
PHMAP_IF_CONSTEXPR (container_internal::Group::kWidth == 8) {
if (kRandomizesInserts) {
return {0.1,
0.5,
@@ -1230,8 +1228,7 @@ ExpectedStats LinearTransformExpectedStats() {
{{0.95, 0.3}},
{{0.95, 0}, {0.99, 3}, {0.999, 15}, {0.9999, 25}}};
}
case 16:
default:
} else {
if (kRandomizesInserts) {
return {0.1,
0.4,
+8
View File
@@ -15,11 +15,19 @@
#ifndef PHMAP_CONTAINER_INTERNAL_UNORDERED_MAP_MODIFIERS_TEST_H_
#define PHMAP_CONTAINER_INTERNAL_UNORDERED_MAP_MODIFIERS_TEST_H_
#ifdef _MSC_VER
#pragma warning(push, 0)
#endif
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "hash_generator_testing.h"
#include "hash_policy_testing.h"
#ifdef _MSC_VER
#pragma warning(pop)
#endif
namespace phmap {
namespace container_internal {