mirror of
https://github.com/utmapp/angle.git
synced 2026-12-01 14:00:09 -10:00
This most strongly affects the Vulkan back-end which uses a hash map to cache VkPipelines. It also should speed up some parts of the D3D11 back-end. Bug: angleproject:2522 Change-Id: I10801654f043abce17339c30d7bf62bc8644e49c Reviewed-on: https://chromium-review.googlesource.com/c/1316889 Commit-Queue: Jamie Madill <[email protected]> Reviewed-by: Jamie Madill <[email protected]>
32 lines
780 B
C++
32 lines
780 B
C++
//
|
|
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
//
|
|
// hash_utils_unittest: Hashing helper functions tests.
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "common/hash_utils.h"
|
|
|
|
using namespace angle;
|
|
|
|
namespace
|
|
{
|
|
// Basic functionality test.
|
|
TEST(HashUtilsTest, ComputeGenericHash)
|
|
{
|
|
std::string a = "aSimpleString!!!";
|
|
std::string b = "anotherString???";
|
|
|
|
// Requires a string size aligned to 4 bytes.
|
|
ASSERT_TRUE(a.size() % 4 == 0);
|
|
ASSERT_TRUE(b.size() % 4 == 0);
|
|
|
|
size_t aHash = ComputeGenericHash(a.c_str(), a.size());
|
|
size_t bHash = ComputeGenericHash(b.c_str(), b.size());
|
|
|
|
EXPECT_NE(aHash, bHash);
|
|
}
|
|
} // anonymous namespace
|