diff options
| author | LC <mathew1800@gmail.com> | 2021-02-18 04:28:54 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-18 04:28:54 -0500 |
| commit | c864f2c5326eb66ab33872c7bf6a341f63b2e197 (patch) | |
| tree | 2ec783f75a4820f798341bafe8d8f671b3a336b3 /src/tests/common/cityhash.cpp | |
| parent | 90f93a408ad428b717e1b4fc5a0ee966659a6cc6 (diff) | |
| parent | f3805376f726e10ff2fe26e99b8702f20eee3eea (diff) | |
Merge pull request #5952 from ReinUsesLisp/cityhash
common/cityhash: Use common types
Diffstat (limited to 'src/tests/common/cityhash.cpp')
| -rw-r--r-- | src/tests/common/cityhash.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tests/common/cityhash.cpp b/src/tests/common/cityhash.cpp new file mode 100644 index 000000000..7a40b6c4a --- /dev/null +++ b/src/tests/common/cityhash.cpp @@ -0,0 +1,22 @@ +// Copyright 2021 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include <catch2/catch.hpp> + +#include "common/cityhash.h" + +constexpr char msg[] = "The blue frogs are singing under the crimson sky.\n" + "It is time to run, Robert."; + +using namespace Common; + +TEST_CASE("CityHash", "[common]") { + // These test results were built against a known good version. + REQUIRE(CityHash64(msg, sizeof(msg)) == 0x92d5c2e9cbfbbc01); + REQUIRE(CityHash64WithSeed(msg, sizeof(msg), 0xdead) == 0xbfbe93f21a2820dd); + REQUIRE(CityHash64WithSeeds(msg, sizeof(msg), 0xbeef, 0xcafe) == 0xb343317955fc8a06); + REQUIRE(CityHash128(msg, sizeof(msg)) == u128{0x98e60d0423747eaa, 0xd8694c5b6fcaede9}); + REQUIRE(CityHash128WithSeed(msg, sizeof(msg), {0xdead, 0xbeef}) == + u128{0xf0307dba81199ebe, 0xd77764e0c4a9eb74}); +} |
