summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorwwylele <wwylele@gmail.com>2017-01-20 20:30:11 +0100
committerwwylele <wwylele@gmail.com>2017-03-01 22:30:57 +0100
commit8a8c0f348b0da4fd91c846211ede568a1f0f11c8 (patch)
treef80158deb9edba170bf73ddfe93326d02976ad09 /src/tests
parentMerge pull request #2603 from wwylele/please-signal (diff)
downloadyuzu-8a8c0f348b0da4fd91c846211ede568a1f0f11c8.tar
yuzu-8a8c0f348b0da4fd91c846211ede568a1f0f11c8.tar.gz
yuzu-8a8c0f348b0da4fd91c846211ede568a1f0f11c8.tar.bz2
yuzu-8a8c0f348b0da4fd91c846211ede568a1f0f11c8.tar.lz
yuzu-8a8c0f348b0da4fd91c846211ede568a1f0f11c8.tar.xz
yuzu-8a8c0f348b0da4fd91c846211ede568a1f0f11c8.tar.zst
yuzu-8a8c0f348b0da4fd91c846211ede568a1f0f11c8.zip
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/CMakeLists.txt1
-rw-r--r--src/tests/common/param_package.cpp25
2 files changed, 26 insertions, 0 deletions
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index b47156ca4..d1144ba77 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -1,6 +1,7 @@
set(SRCS
glad.cpp
tests.cpp
+ common/param_package.cpp
core/file_sys/path_parser.cpp
)
diff --git a/src/tests/common/param_package.cpp b/src/tests/common/param_package.cpp
new file mode 100644
index 000000000..efec2cc86
--- /dev/null
+++ b/src/tests/common/param_package.cpp
@@ -0,0 +1,25 @@
+// Copyright 2017 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include <catch.hpp>
+#include <math.h>
+#include "common/param_package.h"
+
+namespace Common {
+
+TEST_CASE("ParamPackage", "[common]") {
+ ParamPackage original{
+ {"abc", "xyz"}, {"def", "42"}, {"jkl", "$$:1:$2$,3"},
+ };
+ original.Set("ghi", 3.14f);
+ ParamPackage copy(original.Serialize());
+ REQUIRE(copy.Get("abc", "") == "xyz");
+ REQUIRE(copy.Get("def", 0) == 42);
+ REQUIRE(std::abs(copy.Get("ghi", 0.0f) - 3.14f) < 0.01f);
+ REQUIRE(copy.Get("jkl", "") == "$$:1:$2$,3");
+ REQUIRE(copy.Get("mno", "uvw") == "uvw");
+ REQUIRE(copy.Get("abc", 42) == 42);
+}
+
+} // namespace Common