A basic components test that just loads all the config files and their components into a world.

This commit is contained in:
Zed A. Shaw 2025-02-21 22:52:53 -05:00
parent d0a6a92bc8
commit b8bb49df2c
2 changed files with 19 additions and 1 deletions

View file

@ -1,11 +1,29 @@
#include <catch2/catch_test_macros.hpp>
#include "components.hpp"
#include "dinkyecs.hpp"
#include "config.hpp"
#include <iostream>
using namespace components;
using namespace DinkyECS;
TEST_CASE("confirm component loading works", "[components]") {
std::vector<std::string> test_list{
"assets/enemies.json", "assets/items.json", "assets/devices.json"};
components::ComponentMap comp_map;
components::configure(comp_map);
DinkyECS::World world;
for(auto test_data : test_list) {
Config config(test_data);
auto data_list = config.json();
for(auto& [key, data] : data_list.items()) {
auto& components = data["components"];
fmt::println("TEST COMPONENT: {} from file {}", key, test_data);
auto ent = world.entity();
components::configure_entity(comp_map, world, ent, components);
}
}
}