A basic components test that just loads all the config files and their components into a world.
This commit is contained in:
parent
d0a6a92bc8
commit
b8bb49df2c
2 changed files with 19 additions and 1 deletions
2
Makefile
2
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 ."
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue