llvm/llvm/unittests/Support/HashBuilderTest.cpp

//===- llvm/unittest/Support/HashBuilderTest.cpp - HashBuilder unit tests -===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "llvm/Support/HashBuilder.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/MD5.h"
#include "llvm/Support/SHA1.h"
#include "llvm/Support/SHA256.h"
#include "gtest/gtest.h"

#include <list>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>

// gtest utilities and macros rely on using a single type. So wrap both the
// hasher type and endianness.
template <typename _HasherT, llvm::endianness _Endianness>
struct HasherTAndEndianness {};
HasherTAndEndiannessToTest;
template <typename HasherT> class HashBuilderTest : public testing::Test {};
TYPED_TEST_SUITE();

HashBuilder;

template <typename HasherTAndEndianness, typename... Ts>
static typename HashBuilder<HasherTAndEndianness>::template HashResultTy<>
hashWithBuilder(const Ts &...Args) {}

template <typename HasherTAndEndianness, typename... Ts>
static typename HashBuilder<HasherTAndEndianness>::template HashResultTy<>
hashRangeWithBuilder(const Ts &...Args) {}

// All the test infrastructure relies on the variadic helpers. Test them first.
TYPED_TEST(HashBuilderTest, VariadicHelpers) {}

TYPED_TEST(HashBuilderTest, AddRangeElements) {}

TYPED_TEST(HashBuilderTest, AddHashableData) {}

struct SimpleStruct {};

template <typename HasherT, llvm::endianness Endianness>
void addHash(llvm::HashBuilder<HasherT, Endianness> &HBuilder,
             const SimpleStruct &Value) {}

struct StructWithoutCopyOrMove {};

// The struct and associated tests are simplified to avoid failures caused by
// different alignments on different platforms.
struct /* __attribute__((packed)) */ StructWithFastHash {};

struct CustomContainer {};

TYPED_TEST(HashBuilderTest, HashUserDefinedStruct) {}

TYPED_TEST(HashBuilderTest, HashArrayRefHashableDataTypes) {}

TYPED_TEST(HashBuilderTest, HashArrayRef) {}

TYPED_TEST(HashBuilderTest, HashArrayRefNonHashableDataTypes) {}

TYPED_TEST(HashBuilderTest, HashStringRef) {}

TYPED_TEST(HashBuilderTest, HashStdString) {}

TYPED_TEST(HashBuilderTest, HashStdPair) {}

TYPED_TEST(HashBuilderTest, HashStdTuple) {}

TYPED_TEST(HashBuilderTest, HashRangeWithForwardIterator) {}

TEST(CustomHasher, CustomHasher) {}