diff --git a/Makefile b/Makefile index a1533ce..3b6a82b 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ tracy_build: meson compile -j 10 -C builddir test: build - ./builddir/runtests + ./builddir/runtests "[components]" run: build test powershell "cp ./builddir/zedcaster.exe ." diff --git a/tests/components.cpp b/tests/components.cpp index 222a17b..386bef8 100644 --- a/tests/components.cpp +++ b/tests/components.cpp @@ -1,11 +1,29 @@ #include #include "components.hpp" #include "dinkyecs.hpp" +#include "config.hpp" +#include using namespace components; using namespace DinkyECS; TEST_CASE("confirm component loading works", "[components]") { + std::vector 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); + } + } }