mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Common: add ParamPackage
This commit is contained in:
		
							parent
							
								
									ad4097e75c
								
							
						
					
					
						commit
						8a8c0f348b
					
				
					 5 changed files with 188 additions and 0 deletions
				
			
		|  | @ -1,6 +1,7 @@ | |||
| set(SRCS | ||||
|             glad.cpp | ||||
|             tests.cpp | ||||
|             common/param_package.cpp | ||||
|             core/file_sys/path_parser.cpp | ||||
|             ) | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										25
									
								
								src/tests/common/param_package.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/tests/common/param_package.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -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
 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue