diff options
| author | bunnei <bunneidev@gmail.com> | 2017-03-17 14:59:39 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-17 14:59:39 -0400 | 
| commit | 423ab5e2bcf5a522e5f412447c05f648df57a14c (patch) | |
| tree | 1e60eaeffa59229254a47f885d2fe2cbbdc1a5c0 /src/tests/common | |
| parent | 3e7459bbf9efa80b2d2dd45b892f7f3cef8ab751 (diff) | |
| parent | b5faa681206e2d82248293591f010f7aea8b99fe (diff) | |
Merge pull request #2497 from wwylele/input-2
Refactor input emulation & add SDL gamepad support
Diffstat (limited to 'src/tests/common')
| -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 @@ +// 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  | 
