diff options
| author | 2017-03-17 14:59:39 -0400 | |
|---|---|---|
| committer | 2017-03-17 14:59:39 -0400 | |
| commit | 423ab5e2bcf5a522e5f412447c05f648df57a14c (patch) | |
| tree | 1e60eaeffa59229254a47f885d2fe2cbbdc1a5c0 /src/tests/common/param_package.cpp | |
| parent | Merge pull request #2618 from wwylele/log-less-filename (diff) | |
| parent | qt/config_input: don't connect for null button (diff) | |
| download | yuzu-423ab5e2bcf5a522e5f412447c05f648df57a14c.tar.gz yuzu-423ab5e2bcf5a522e5f412447c05f648df57a14c.tar.xz yuzu-423ab5e2bcf5a522e5f412447c05f648df57a14c.zip | |
Merge pull request #2497 from wwylele/input-2
Refactor input emulation & add SDL gamepad support
Diffstat (limited to 'src/tests/common/param_package.cpp')
| -rw-r--r-- | src/tests/common/param_package.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
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 @@ | |||
| 1 | // Copyright 2017 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <catch.hpp> | ||
| 6 | #include <math.h> | ||
| 7 | #include "common/param_package.h" | ||
| 8 | |||
| 9 | namespace Common { | ||
| 10 | |||
| 11 | TEST_CASE("ParamPackage", "[common]") { | ||
| 12 | ParamPackage original{ | ||
| 13 | {"abc", "xyz"}, {"def", "42"}, {"jkl", "$$:1:$2$,3"}, | ||
| 14 | }; | ||
| 15 | original.Set("ghi", 3.14f); | ||
| 16 | ParamPackage copy(original.Serialize()); | ||
| 17 | REQUIRE(copy.Get("abc", "") == "xyz"); | ||
| 18 | REQUIRE(copy.Get("def", 0) == 42); | ||
| 19 | REQUIRE(std::abs(copy.Get("ghi", 0.0f) - 3.14f) < 0.01f); | ||
| 20 | REQUIRE(copy.Get("jkl", "") == "$$:1:$2$,3"); | ||
| 21 | REQUIRE(copy.Get("mno", "uvw") == "uvw"); | ||
| 22 | REQUIRE(copy.Get("abc", 42) == 42); | ||
| 23 | } | ||
| 24 | |||
| 25 | } // namespace Common | ||