Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/angle
Path: blob/main_old/src/common/hash_utils_unittest.cpp
1693 views
1
//
2
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
3
// Use of this source code is governed by a BSD-style license that can be
4
// found in the LICENSE file.
5
//
6
// hash_utils_unittest: Hashing helper functions tests.
7
8
#include <gtest/gtest.h>
9
10
#include "common/hash_utils.h"
11
12
using namespace angle;
13
14
namespace
15
{
16
// Basic functionality test.
17
TEST(HashUtilsTest, ComputeGenericHash)
18
{
19
std::string a = "aSimpleString!!!";
20
std::string b = "anotherString???";
21
22
// Requires a string size aligned to 4 bytes.
23
ASSERT_TRUE(a.size() % 4 == 0);
24
ASSERT_TRUE(b.size() % 4 == 0);
25
26
size_t aHash = ComputeGenericHash(a.c_str(), a.size());
27
size_t bHash = ComputeGenericHash(b.c_str(), b.size());
28
29
EXPECT_NE(aHash, bHash);
30
}
31
} // anonymous namespace
32
33