First cut of pulling out the relevant parts of my original game to make a little framework.
This commit is contained in:
commit
6a0c9e8d46
177 changed files with 18197 additions and 0 deletions
28
tests/config.cpp
Normal file
28
tests/config.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include <catch2/catch_test_macros.hpp>
|
||||
#include "game/config.hpp"
|
||||
#include <iostream>
|
||||
|
||||
TEST_CASE("confirm basic config loader ops", "[config]") {
|
||||
settings::Config::set_base_dir("./");
|
||||
auto config = settings::get("devices");
|
||||
auto data_list = config.json();
|
||||
auto the_keys = config.keys();
|
||||
|
||||
REQUIRE(the_keys.size() > 0);
|
||||
|
||||
for(auto& [key, data] : data_list.items()) {
|
||||
auto wide1 = config.wstring(key, "name");
|
||||
auto& comps = data["components"];
|
||||
|
||||
for(auto& comp_data : comps) {
|
||||
REQUIRE(comp_data.contains("_type"));
|
||||
}
|
||||
}
|
||||
|
||||
auto indexed = settings::get("tests/config_test.json");
|
||||
auto& test_0 = indexed[0];
|
||||
REQUIRE(test_0["test"] == 0);
|
||||
|
||||
auto& test_1 = indexed[1];
|
||||
REQUIRE(test_1["test"] == 1);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue