diff --git a/Makefile b/Makefile index 3b6a82b..a1533ce 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ tracy_build: meson compile -j 10 -C builddir test: build - ./builddir/runtests "[components]" + ./builddir/runtests run: build test powershell "cp ./builddir/zedcaster.exe ." diff --git a/assets/enemies.json b/assets/enemies.json index 8011e27..f3ca362 100644 --- a/assets/enemies.json +++ b/assets/enemies.json @@ -31,6 +31,7 @@ "foreground": [156, 172, 197], "background": [30, 20, 75] }, + {"_type": "LightSource", "strength": 80, "radius": 2.8}, {"_type": "Combat", "hp": 40, "max_hp": 40, "damage": 10, "dead": false}, {"_type": "Motion", "dx": 0, "dy": 0, "random": true}, {"_type": "EnemyConfig", "hearing_distance": 5}, diff --git a/meson.build b/meson.build index 31158e2..639ec22 100644 --- a/meson.build +++ b/meson.build @@ -92,10 +92,12 @@ sources = [ executable('runtests', sources + [ 'tests/ansi_parser.cpp', 'tests/base.cpp', + 'tests/components.cpp', + 'tests/config.cpp', 'tests/dbc.cpp', 'tests/dinkyecs.cpp', - 'tests/guecs.cpp', 'tests/fsm.cpp', + 'tests/guecs.cpp', 'tests/inventory.cpp', 'tests/lel.cpp', 'tests/levelmanager.cpp', @@ -104,9 +106,8 @@ executable('runtests', sources + [ 'tests/matrix.cpp', 'tests/pathing.cpp', 'tests/spatialmap.cpp', - 'tests/tilemap.cpp', - 'tests/components.cpp', 'tests/textures.cpp', + 'tests/tilemap.cpp', ], override_options: exe_defaults, dependencies: dependencies + [catch2]) diff --git a/tests/config.cpp b/tests/config.cpp new file mode 100644 index 0000000..96e59cc --- /dev/null +++ b/tests/config.cpp @@ -0,0 +1,18 @@ +#include +#include "config.hpp" +#include + +TEST_CASE("confirm basic config loader ops", "[config]") { + Config config("assets/devices.json"); + auto data_list = config.json(); + + + 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")); + } + } +}