Go to the documentation of this file.
15 #ifndef ABSL_HASH_HASH_TESTING_H_
16 #define ABSL_HASH_HASH_TESTING_H_
18 #include <initializer_list>
20 #include <type_traits>
23 #include "gmock/gmock.h"
24 #include "gtest/gtest.h"
25 #include "absl/hash/internal/spy_hash_state.h"
26 #include "absl/meta/type_traits.h"
27 #include "absl/strings/str_cat.h"
28 #include "absl/types/variant.h"
143 template <
int&... ExplicitBarrier,
typename Container>
147 template <
int&... ExplicitBarrier,
typename Container,
typename Eq>
151 template <
int&...,
typename T>
155 template <
int&...,
typename T,
typename Eq>
160 namespace hash_internal {
164 template <
typename T>
170 template <
typename Eq>
173 template <
typename T,
typename U>
180 template <
typename T>
186 template <
typename Container,
typename Eq>
200 using EqClass = std::vector<Info>;
206 EqClass* c =
nullptr;
207 for (
auto& eqclass :
classes) {
221 if (
auto error = c->back().expand().error()) {
228 <<
"At least two equivalence classes are expected.";
234 for (
const auto& c :
classes) {
238 for (
const Info&
v : c) {
239 if (
v.expand() !=
v.expand()) {
241 <<
"Hash expansion for " <<
v.ToString()
242 <<
" is non-deterministic.";
244 if (
v.expand() != expected) {
246 <<
"Values " << c[0].ToString() <<
" and " <<
v.ToString()
247 <<
" evaluate as equal but have an unequal hash expansion.";
253 if (&c == &
c2)
continue;
258 <<
"Values " << c[0].ToString() <<
" and " <<
c2[0].ToString()
259 <<
" evaluate as unequal but have an equal hash expansion.";
262 <<
"Hash expansion of " <<
c2[0].ToString()
263 <<
" is a suffix of the hash expansion of " << c[0].ToString()
267 <<
"Hash expansion of " << c[0].ToString()
268 <<
" is a suffix of the hash expansion of " <<
c2[0].ToString()
278 template <
typename...
T>
280 template <
typename U,
bool = disjunction<std::is_same<T, U>...>::value>
284 template <
typename U>
289 template <
template <
typename...>
class C>
293 template <
typename...
T>
295 template <
typename T,
typename... Ts>
298 template <
typename...
T>
302 template <
typename Container>
305 using Out = std::vector<V>;
314 template <
typename...
T>
317 using Out = std::vector<V>;
319 template <
size_t...
I>
321 return Out{&std::get<I>(tuple)...};
331 static std::vector<VariantForTypes<int>>
Do(std::tuple<>) {
return {}; }
335 template <
typename T,
typename U>
343 template <
int&...,
typename Container>
351 template <
int&...,
typename Container,
typename Eq>
358 template <
int&...,
typename T>
366 template <
int&...,
typename T,
typename Eq>
378 #endif // ABSL_HASH_HASH_TESTING_H_
AssertionResult AssertionFailure()
bool operator()(const T &t, const U &u) const
ABSL_NAMESPACE_BEGIN ABSL_MUST_USE_RESULT testing::AssertionResult VerifyTypeImplementsAbslHashCorrectly(const Container &values)
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
static SpyHashStateImpl combine(SpyHashStateImpl s, const A &a, const Args &... args)
static Out Do(const Container &values)
VariantForTypes< T... > V
OPENSSL_EXPORT pem_password_cb void * u
#define ABSL_NAMESPACE_END
#define T(upbtypeconst, upbtype, ctype, default_value)
bool operator()(const T *t, const U *u) const
#define ABSL_MUST_USE_RESULT
absl::string_view ToString(TestCordSize size)
#define ABSL_NAMESPACE_BEGIN
static Out DoImpl(const std::tuple< T... > &tuple, absl::index_sequence< I... >)
std::string operator()(const T *value) const
internal::EqMatcher< T > Eq(T x)
AssertionResult AssertionSuccess()
static std::vector< VariantForTypes< int > > Do(std::tuple<>)
make_index_sequence< sizeof...(Ts)> index_sequence_for
static const struct nv classes[]
SpyHashStateImpl< void > SpyHashState
static Out Do(const std::tuple< T... > &values)
std::array< int64_t, Size > values
static CompareResult Compare(const SpyHashStateImpl &a, const SpyHashStateImpl &b)
ABSL_MUST_USE_RESULT testing::AssertionResult VerifyTypeImplementsAbslHashCorrectly(const Container &values, Eq equals)
static PyObject * Insert(PyObject *pself, PyObject *args)
variant_internal::VisitResult< Visitor, Variants... > visit(Visitor &&vis, Variants &&... vars)
SpyHashState operator()(const T *value) const
typename MakeTypeSet< const typename std::decay< T >::type *... >::template apply< absl::variant > VariantForTypes
::std::string PrintToString(const T &value)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:01