You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
704 B
28 lines
704 B
#include <catch2/catch_test_macros.hpp>
|
|
#include "config.hpp"
|
|
#include <iostream>
|
|
|
|
TEST_CASE("confirm basic config loader ops", "[config]") {
|
|
Config::set_base_dir("./");
|
|
Config config("assets/devices.json");
|
|
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"));
|
|
}
|
|
}
|
|
|
|
Config indexed("tests/config_test.json");
|
|
auto& test_0 = indexed[0];
|
|
REQUIRE(test_0["test"] == 0);
|
|
|
|
auto& test_1 = indexed[1];
|
|
REQUIRE(test_1["test"] == 1);
|
|
}
|
|
|