chromium/third_party/abseil-cpp/absl/hash/internal/hash_test.h

// Copyright 2023 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Common code shared between absl/hash/hash_test.cc and
// absl/hash/hash_instantiated_test.cc.

#ifndef ABSL_HASH_INTERNAL_HASH_TEST_H_
#define ABSL_HASH_INTERNAL_HASH_TEST_H_

#include <type_traits>
#include <utility>

#include "absl/base/config.h"
#include "absl/hash/hash.h"

namespace absl {
ABSL_NAMESPACE_BEGIN
namespace hash_test_internal {

// Utility wrapper of T for the purposes of testing the `AbslHash` type erasure
// mechanism.  `TypeErasedValue<T>` can be constructed with a `T`, and can
// be compared and hashed.  However, all hashing goes through the hashing
// type-erasure framework.
template <typename T>
class TypeErasedValue {};

// A TypeErasedValue refinement, for containers.  It exposes the wrapped
// `value_type` and is constructible from an initializer list.
template <typename T>
class TypeErasedContainer : public TypeErasedValue<T> {};

// Helper trait to verify if T is hashable. We use absl::Hash's poison status to
// detect it.
is_hashable;

}  // namespace hash_test_internal
ABSL_NAMESPACE_END
}  // namespace absl

#endif  // ABSL_HASH_INTERNAL_HASH_TEST_H_