summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-02-18 04:43:42 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2021-02-18 04:44:57 +0100
commit9ca5e52f0713bf394cae09fdd522133227860a94 (patch)
tree1d91f699f3f454a3b9730386946748877fa411c5 /src
parentMerge pull request #5121 from bunnei/optimize-core-timing (diff)
downloadyuzu-9ca5e52f0713bf394cae09fdd522133227860a94.tar
yuzu-9ca5e52f0713bf394cae09fdd522133227860a94.tar.gz
yuzu-9ca5e52f0713bf394cae09fdd522133227860a94.tar.bz2
yuzu-9ca5e52f0713bf394cae09fdd522133227860a94.tar.lz
yuzu-9ca5e52f0713bf394cae09fdd522133227860a94.tar.xz
yuzu-9ca5e52f0713bf394cae09fdd522133227860a94.tar.zst
yuzu-9ca5e52f0713bf394cae09fdd522133227860a94.zip
Diffstat (limited to 'src')
-rw-r--r--src/tests/CMakeLists.txt1
-rw-r--r--src/tests/common/cityhash.cpp22
2 files changed, 23 insertions, 0 deletions
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index 6a5c18945..4ea0076e9 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -1,5 +1,6 @@
add_executable(tests
common/bit_field.cpp
+ common/cityhash.cpp
common/fibers.cpp
common/param_package.cpp
common/ring_buffer.cpp
diff --git a/src/tests/common/cityhash.cpp b/src/tests/common/cityhash.cpp
new file mode 100644
index 000000000..172dd55b4
--- /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)) == uint128{0x98e60d0423747eaa, 0xd8694c5b6fcaede9});
+ REQUIRE(CityHash128WithSeed(msg, sizeof(msg), {0xdead, 0xbeef}) ==
+ uint128{0xf0307dba81199ebe, 0xd77764e0c4a9eb74});
+}