Now have a working config manager that can exist in the world properly.
This commit is contained in:
parent
f6ddf4b03b
commit
ddf1ba955c
5 changed files with 46 additions and 6 deletions
|
@ -33,11 +33,30 @@ TEST_CASE("basic configuration system", "[config]") {
|
|||
REQUIRE(test_obj["name"] == "Zed");
|
||||
}
|
||||
|
||||
void test_func(Config &ref) {
|
||||
void test_can_ref(Config &ref) {
|
||||
REQUIRE(ref["types"]["OBJECT"]["name"] == "Zed");
|
||||
}
|
||||
|
||||
TEST_CASE("store config in any", "[config]") {
|
||||
TEST_CASE("can get references of config", "[config]") {
|
||||
Config config("./tests/config.json");
|
||||
test_func(config);
|
||||
test_can_ref(config);
|
||||
}
|
||||
|
||||
TEST_CASE("store config in any", "[config]") {
|
||||
auto as_any = std::make_any<Config>("./tests/config.json");
|
||||
|
||||
Config &cfg = std::any_cast<Config &>(as_any);
|
||||
REQUIRE(cfg["types"]["NUMBER"] == 1234);
|
||||
}
|
||||
|
||||
void test_will_live(DinkyECS::World &world) {
|
||||
Config config("./tests/config.json");
|
||||
world.set_the<Config>(config);
|
||||
}
|
||||
|
||||
TEST_CASE("can go into a world", "[config]") {
|
||||
DinkyECS::World world;
|
||||
test_will_live(world);
|
||||
Config &cfg = world.get_the<Config>();
|
||||
REQUIRE(cfg["types"]["NUMBER"] == 1234);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue