Started to convert from catch2 to fuc2.

This commit is contained in:
Zed A. Shaw 2026-06-16 04:38:38 -04:00
parent 4deda37665
commit b8b42d5681
10 changed files with 615 additions and 493 deletions

View file

@ -1,4 +1,3 @@
#include <catch2/catch_test_macros.hpp>
#include "graphics/textures.hpp" #include "graphics/textures.hpp"
#include "algos/dinkyecs.hpp" #include "algos/dinkyecs.hpp"
#include "game/config.hpp" #include "game/config.hpp"
@ -10,13 +9,16 @@
#include "graphics/animation.hpp" #include "graphics/animation.hpp"
#include "game/sound.hpp" #include "game/sound.hpp"
#include "game/components.hpp" #include "game/components.hpp"
#include <fuc2/testing.hpp>
using namespace components; using namespace components;
using namespace textures; using namespace textures;
using namespace std::chrono_literals; using namespace std::chrono_literals;
using namespace animation; using namespace animation;
using namespace fuc2;
Animation load_animation(const string& name) { namespace animation_tests {
Animation load_animation(const string& name) {
auto anim = animation::load("assets/animation.json", "rat_king_boss"); auto anim = animation::load("assets/animation.json", "rat_king_boss");
anim.set_form("attack"); anim.set_form("attack");
@ -27,14 +29,14 @@ Animation load_animation(const string& name) {
} }
return anim; return anim;
} }
void FAKE_RENDER() { void FAKE_RENDER() {
std::this_thread::sleep_for(Random::milliseconds(5, 32)); std::this_thread::sleep_for(Random::milliseconds(5, 32));
} }
void PLAY_TEST(Animation &anim) { void PLAY_TEST(Animation &anim) {
REQUIRE(anim.transform.looped == false); CHECK(anim.transform.looped == false);
anim.play(); anim.play();
while(anim.playing) { while(anim.playing) {
@ -42,10 +44,10 @@ void PLAY_TEST(Animation &anim) {
FAKE_RENDER(); FAKE_RENDER();
} }
REQUIRE(anim.playing == false); CHECK(anim.playing == false);
} }
/* /*
* Animation is a Sheet + Sequence + Transform. * Animation is a Sheet + Sequence + Transform.
* *
* A Sheet is just a grid of images with a predefined size for each cell. Arbitrary sized cells not supported. * A Sheet is just a grid of images with a predefined size for each cell. Arbitrary sized cells not supported.
@ -56,7 +58,7 @@ void PLAY_TEST(Animation &anim) {
* *
* I like the ganim8 onLoop concept, just a callback that says what to do when the animation has looped. * I like the ganim8 onLoop concept, just a callback that says what to do when the animation has looped.
*/ */
TEST_CASE("new animation system", "[animation-new]") { void test_new_animation_system() {
textures::init(); textures::init();
sound::init(); sound::init();
sound::mute(true); sound::mute(true);
@ -67,7 +69,7 @@ TEST_CASE("new animation system", "[animation-new]") {
// test that toggled works // test that toggled works
anim.transform.toggled = true; anim.transform.toggled = true;
PLAY_TEST(anim); PLAY_TEST(anim);
REQUIRE(anim.sequence.current == anim.sequence.frames.size() - 1); CHECK(anim.sequence.current == anim.sequence.frames.size() - 1);
anim.transform.toggled = false; anim.transform.toggled = false;
bool onLoop_ran = false; bool onLoop_ran = false;
@ -78,7 +80,7 @@ TEST_CASE("new animation system", "[animation-new]") {
}; };
PLAY_TEST(anim); PLAY_TEST(anim);
REQUIRE(onLoop_ran == true); CHECK(onLoop_ran == true);
// only runs twice // only runs twice
anim.onLoop = [](auto& seq, auto& tr) -> bool { anim.onLoop = [](auto& seq, auto& tr) -> bool {
@ -92,11 +94,11 @@ TEST_CASE("new animation system", "[animation-new]") {
}; };
PLAY_TEST(anim); PLAY_TEST(anim);
REQUIRE(anim.sequence.loop_count == 2); CHECK(anim.sequence.loop_count == 2);
} }
TEST_CASE("confirm frame sequencing works", "[animation-new]") { void test_confirm_frame_sequencing_works() {
textures::init(); textures::init();
sound::init(); sound::init();
sound::mute(true); sound::mute(true);
@ -125,11 +127,11 @@ TEST_CASE("confirm frame sequencing works", "[animation-new]") {
FAKE_RENDER(); FAKE_RENDER();
} }
REQUIRE(loop_ran == true); CHECK(loop_ran == true);
REQUIRE(anim.playing == false); CHECK(anim.playing == false);
} }
TEST_CASE("confirm transition changes work", "[animation-new]") { void test_confirm_transition_changes_work() {
textures::init(); textures::init();
sound::init(); sound::init();
sound::mute(true); sound::mute(true);
@ -141,10 +143,10 @@ TEST_CASE("confirm transition changes work", "[animation-new]") {
auto anim = load_animation("rat_king_boss"); auto anim = load_animation("rat_king_boss");
// also testing that onFrame being null means it's not run // also testing that onFrame being null means it's not run
REQUIRE(anim.onFrame == nullptr); CHECK(anim.onFrame == nullptr);
anim.play(); anim.play();
REQUIRE(anim.playing == true); CHECK(anim.playing == true);
while(anim.playing) { while(anim.playing) {
anim.update(); anim.update();
@ -152,12 +154,12 @@ TEST_CASE("confirm transition changes work", "[animation-new]") {
FAKE_RENDER(); FAKE_RENDER();
} }
REQUIRE(anim.playing == false); CHECK(anim.playing == false);
REQUIRE(pos == sf::Vector2f{100, 100}); CHECK(pos == sf::Vector2f{100, 100});
REQUIRE(scale != sf::Vector2f{0,0}); CHECK(scale != sf::Vector2f{0,0});
} }
TEST_CASE("playing with delta time", "[animation-new]") { void test_playing_with_delta_time() {
animation::Timer timer; animation::Timer timer;
timer.start(); timer.start();
@ -166,4 +168,17 @@ TEST_CASE("playing with delta time", "[animation-new]") {
auto [tick_count, alpha] = timer.commit(); auto [tick_count, alpha] = timer.commit();
// fmt::println("tick: {}, alpha: {}", tick_count, alpha); // fmt::println("tick: {}, alpha: {}", tick_count, alpha);
} }
}
fuc2::Set TESTS{
.name="ai functionality",
.tests={
TEST(test_new_animation_system),
TEST(test_confirm_frame_sequencing_works),
TEST(test_confirm_transition_changes_work),
TEST(test_playing_with_delta_time),
}
};
} }

View file

@ -1,9 +1,18 @@
#include <catch2/catch_test_macros.hpp>
#include <fmt/core.h> #include <fmt/core.h>
#include <string> #include <string>
#include <fuc2/testing.hpp>
using namespace fmt; using namespace fuc2;
TEST_CASE("base test", "[base]") { namespace base_tests {
REQUIRE(1 == 1); void test_base_test() {
CHECK(1 == 1);
}
fuc2::Set TESTS{
.name="base template",
.tests={
TEST(test_base_test),
}
};
} }

View file

@ -1,4 +1,3 @@
#include <catch2/catch_test_macros.hpp>
#include <iostream> #include <iostream>
#include <set> #include <set>
#include "game/rituals.hpp" #include "game/rituals.hpp"
@ -11,12 +10,15 @@
#include "game/components.hpp" #include "game/components.hpp"
#include "ai/ai.hpp" #include "ai/ai.hpp"
#include "graphics/palette.hpp" #include "graphics/palette.hpp"
#include <fuc2/testing.hpp>
using namespace combat; using namespace combat;
using namespace boss; using namespace boss;
using namespace components; using namespace components;
using namespace fuc2;
TEST_CASE("battle operations fantasy", "[fail]") { namespace battle_tests {
void test_battle_operations_fantasy() {
ai::reset(); ai::reset();
ai::init("ai"); ai::init("ai");
@ -83,7 +85,7 @@ TEST_CASE("battle operations fantasy", "[fail]") {
case BattleHostState::disagree: case BattleHostState::disagree:
// fmt::println("REBELIOUS ACT: {}", wants_to); // fmt::println("REBELIOUS ACT: {}", wants_to);
battle.clear_requests(); battle.clear_requests();
REQUIRE(battle.$player_requests.size() == 0); CHECK(battle.$player_requests.size() == 0);
break; break;
case BattleHostState::not_host: case BattleHostState::not_host:
if(wants_to == "kill_enemy") { if(wants_to == "kill_enemy") {
@ -96,14 +98,14 @@ TEST_CASE("battle operations fantasy", "[fail]") {
} }
} }
REQUIRE(!battle.next()); CHECK(!battle.next());
dbc::check(battle_count < 1000, "infinite battle loop"); dbc::check(battle_count < 1000, "infinite battle loop");
} }
dbc::check(host_combat_loop < 1000, "infinite host combat loop, host won't die!"); dbc::check(host_combat_loop < 1000, "infinite host combat loop, host won't die!");
} }
TEST_CASE("boss/systems.cpp works", "[combat-battle]") { void test_boss_systems_work() {
components::init(); components::init();
gui::Backend backend; gui::Backend backend;
guecs::init(&backend); guecs::init(&backend);
@ -131,7 +133,7 @@ TEST_CASE("boss/systems.cpp works", "[combat-battle]") {
battle.player_request("kill_enemy"); battle.player_request("kill_enemy");
int pending_ap = battle.player_pending_ap(); int pending_ap = battle.player_pending_ap();
REQUIRE(pending_ap < host_combat.ap); CHECK(pending_ap < host_combat.ap);
System::plan_battle(battle, fight->$world, fight->$boss_id); System::plan_battle(battle, fight->$world, fight->$boss_id);
@ -140,5 +142,14 @@ TEST_CASE("boss/systems.cpp works", "[combat-battle]") {
System::combat(*action, fight->$world, fight->$boss_id, 0); System::combat(*action, fight->$world, fight->$boss_id, 0);
} }
REQUIRE(host_combat.ap == pending_ap); CHECK(host_combat.ap == pending_ap);
}
fuc2::Set TESTS{
.name="battle tests",
.tests={
TEST(test_battle_operations_fantasy),
TEST(test_boss_systems_work),
}
};
} }

View file

@ -1,6 +1,17 @@
#include <catch2/catch_test_macros.hpp>
#include <fmt/core.h> #include <fmt/core.h>
#include <fuc2/testing.hpp>
TEST_CASE("view based camera system", "[camera]") { using namespace fuc2;
REQUIRE(1 == 1);
namespace camera_tests {
void test_view_based_camera_system() {
CHECK(1 == 1);
}
fuc2::Set TESTS{
.name="camera tests (EMPTY!)",
.tests={
TEST(test_view_based_camera_system),
}
};
} }

View file

@ -1,4 +1,4 @@
#include <catch2/catch_test_macros.hpp> #include <fuc2/testing.hpp>
#include "game/components.hpp" #include "game/components.hpp"
#include "algos/dinkyecs.hpp" #include "algos/dinkyecs.hpp"
#include "game/config.hpp" #include "game/config.hpp"
@ -7,7 +7,10 @@
using namespace components; using namespace components;
using namespace DinkyECS; using namespace DinkyECS;
TEST_CASE("confirm component loading works", "[components]") { using namespace fuc2;
namespace component_tests {
void test_confirm_component_loading_works() {
std::vector<std::string> test_list{ std::vector<std::string> test_list{
"assets/enemies.json", "assets/items.json", "assets/devices.json"}; "assets/enemies.json", "assets/items.json", "assets/devices.json"};
@ -24,12 +27,12 @@ TEST_CASE("confirm component loading works", "[components]") {
auto ent = world.entity(); auto ent = world.entity();
components::configure_entity(world, ent, components); components::configure_entity(world, ent, components);
auto tile = components::get<Tile>(components[0]); auto tile = components::get<Tile>(components[0]);
REQUIRE(tile.display != L' '); CHECK(tile.display != L' ');
}
} }
} }
}
TEST_CASE("make sure json_mods works", "[components]") { void test_make_sure_json_mods_works() {
auto config = settings::get("bosses"); auto config = settings::get("bosses");
// this confirms that loading something with an optional // this confirms that loading something with an optional
// field works with the json conversions in json_mods.hpp // field works with the json conversions in json_mods.hpp
@ -47,4 +50,13 @@ TEST_CASE("make sure json_mods works", "[components]") {
components::configure_entity(world, rat_king, config["RAT_KING"]["components"]); components::configure_entity(world, rat_king, config["RAT_KING"]["components"]);
auto boss = world.get<AnimatedScene>(rat_king); auto boss = world.get<AnimatedScene>(rat_king);
}
fuc2::Set TESTS{
.name="components",
.tests={
TEST(test_make_sure_json_mods_works),
TEST(test_confirm_component_loading_works),
}
};
} }

View file

@ -1,28 +1,40 @@
#include <catch2/catch_test_macros.hpp> #include <fuc2/testing.hpp>
#include "game/config.hpp" #include "game/config.hpp"
#include <iostream> #include <iostream>
TEST_CASE("confirm basic config loader ops", "[config]") { using namespace fuc2;
namespace config_tests {
void test_confirm_basic_config_loader_ops() {
settings::Config::set_base_dir("./"); settings::Config::set_base_dir("./");
auto config = settings::get("devices"); auto config = settings::get("devices");
auto data_list = config.json(); auto data_list = config.json();
auto the_keys = config.keys(); auto the_keys = config.keys();
REQUIRE(the_keys.size() > 0); CHECK(the_keys.size() > 0);
for(auto& [key, data] : data_list.items()) { for(auto& [key, data] : data_list.items()) {
auto wide1 = config.wstring(key, "name"); auto wide1 = config.wstring(key, "name");
auto& comps = data["components"]; auto& comps = data["components"];
for(auto& comp_data : comps) { for(auto& comp_data : comps) {
REQUIRE(comp_data.contains("_type")); CHECK(comp_data.contains("_type"));
} }
} }
auto indexed = settings::get("tests/config_test.json"); auto indexed = settings::get("tests/config_test.json");
auto& test_0 = indexed[0]; auto& test_0 = indexed[0];
REQUIRE(test_0["test"] == 0); CHECK(test_0["test"] == 0);
auto& test_1 = indexed[1]; auto& test_1 = indexed[1];
REQUIRE(test_1["test"] == 1); CHECK(test_1["test"] == 1);
}
fuc2::Set TESTS{
.name="config",
.tests={
TEST(test_confirm_basic_config_loader_ops),
}
};
} }

View file

@ -1,9 +1,10 @@
#include <catch2/catch_test_macros.hpp> #include <fuc2/testing.hpp>
#include "dbc.hpp" #include "dbc.hpp"
using namespace dbc; using namespace dbc;
TEST_CASE("basic feature tests", "[dbc]") { namespace dbc_tests {
void test_basic_dbc_features() {
log("Logging a message."); log("Logging a message.");
pre("confirm positive cases work", 1 == 1); pre("confirm positive cases work", 1 == 1);
@ -15,4 +16,13 @@ TEST_CASE("basic feature tests", "[dbc]") {
post("confirm postitive post with lamdba", [&]{ return 1 == 1;}); post("confirm postitive post with lamdba", [&]{ return 1 == 1;});
check(1 == 1, "one equals 1"); check(1 == 1, "one equals 1");
}
fuc2::Set TESTS{
.name="dbc",
.tests={
TEST(test_basic_dbc_features),
}
};
} }

View file

@ -1,4 +1,4 @@
#include <catch2/catch_test_macros.hpp> #include <fuc2/testing.hpp>
#include "algos/dinkyecs.hpp" #include "algos/dinkyecs.hpp"
#include <iostream> #include <iostream>
#include <fmt/core.h> #include <fmt/core.h>
@ -6,44 +6,46 @@
using namespace fmt; using namespace fmt;
using DinkyECS::Entity; using DinkyECS::Entity;
using std::string; using std::string;
using namespace fuc2;
struct Point { namespace dinkyecs_tests {
struct Point {
size_t x; size_t x;
size_t y; size_t y;
}; };
struct Player { struct Player {
string name; string name;
Entity eid; Entity eid;
}; };
struct Position { struct Position {
Point location; Point location;
}; };
struct Motion { struct Motion {
int dx; int dx;
int dy; int dy;
bool random=false; bool random=false;
}; };
struct Velocity { struct Velocity {
double x, y; double x, y;
}; };
struct Gravity { struct Gravity {
double level; double level;
}; };
struct DaGUI { struct DaGUI {
int event; int event;
}; };
/* /*
* Using a function catches instances where I'm not copying * Using a function catches instances where I'm not copying
* the data into the world. * the data into the world.
*/ */
void configure(DinkyECS::World &world, Entity &test) { void configure(DinkyECS::World &world, Entity &test) {
println("---Configuring the base system."); println("---Configuring the base system.");
Entity test2 = world.entity(); Entity test2 = world.entity();
@ -69,83 +71,87 @@ void configure(DinkyECS::World &world, Entity &test) {
println("--- Creating facts (singletons)"); println("--- Creating facts (singletons)");
world.set_the<Gravity>({0.9}); world.set_the<Gravity>({0.9});
} }
TEST_CASE("confirm ECS system works", "[ecs]") { void test_confirm_ECS_system_works() {
DinkyECS::World world; DinkyECS::World world;
Entity test = world.entity(); Entity test = world.entity();
configure(world, test); configure(world, test);
Position &pos = world.get<Position>(test); Position &pos = world.get<Position>(test);
REQUIRE(pos.location.x == 10); CHECK(pos.location.x == 10);
REQUIRE(pos.location.y == 20); CHECK(pos.location.y == 20);
Velocity &vel = world.get<Velocity>(test); Velocity &vel = world.get<Velocity>(test);
REQUIRE(vel.x == 1); CHECK(vel.x == 1);
REQUIRE(vel.y == 2); CHECK(vel.y == 2);
world.query<Position>([](const auto &ent, auto &pos) { world.query<Position>([](const auto &ent, auto &pos) {
REQUIRE(ent > 0); CHECK(ent > 0);
REQUIRE(pos.location.x >= 0); CHECK(pos.location.x >= 0);
REQUIRE(pos.location.y >= 0); CHECK(pos.location.y >= 0);
}); });
world.query<Velocity>([](const auto &ent, auto &vel) { world.query<Velocity>([](const auto &ent, auto &vel) {
REQUIRE(ent > 0); CHECK(ent > 0);
REQUIRE(vel.x >= 0); CHECK(vel.x >= 0);
REQUIRE(vel.y >= 0); CHECK(vel.y >= 0);
}); });
println("--- Manually get the velocity in position system:"); println("--- Manually get the velocity in position system:");
world.query<Position>([&](const auto &ent, auto &pos) { world.query<Position>([&](const auto &ent, auto &pos) {
Velocity &vel = world.get<Velocity>(ent); Velocity &vel = world.get<Velocity>(ent);
REQUIRE(ent > 0); CHECK(ent > 0);
REQUIRE(pos.location.x >= 0); CHECK(pos.location.x >= 0);
REQUIRE(pos.location.y >= 0); CHECK(pos.location.y >= 0);
REQUIRE(ent > 0); CHECK(ent > 0);
REQUIRE(vel.x >= 0); CHECK(vel.x >= 0);
REQUIRE(vel.y >= 0); CHECK(vel.y >= 0);
}); });
println("--- Query only entities with Position and Velocity:"); println("--- Query only entities with Position and Velocity:");
world.query<Position, Velocity>([&](const auto &ent, auto &pos, auto &vel) { world.query<Position, Velocity>([&](const auto &ent, auto &pos, auto &vel) {
Gravity &grav = world.get_the<Gravity>(); Gravity &grav = world.get_the<Gravity>();
REQUIRE(grav.level <= 1.0f); CHECK(grav.level <= 1.0f);
REQUIRE(grav.level > 0.5f); CHECK(grav.level > 0.5f);
REQUIRE(ent > 0); CHECK(ent > 0);
REQUIRE(pos.location.x >= 0); CHECK(pos.location.x >= 0);
REQUIRE(pos.location.y >= 0); CHECK(pos.location.y >= 0);
REQUIRE(ent > 0); CHECK(ent > 0);
REQUIRE(vel.x >= 0); CHECK(vel.x >= 0);
REQUIRE(vel.y >= 0); CHECK(vel.y >= 0);
}); });
// now remove Velocity // now remove Velocity
REQUIRE(world.has<Velocity>(test)); CHECK(world.has<Velocity>(test));
world.remove<Velocity>(test); world.remove<Velocity>(test);
REQUIRE_THROWS(world.get<Velocity>(test));
REQUIRE(!world.has<Velocity>(test)); BLOWS_UP([&]() {
world.get<Velocity>(test);
});
CHECK(!world.has<Velocity>(test));
println("--- After remove test, should only result in test2:"); println("--- After remove test, should only result in test2:");
world.query<Position, Velocity>([&](const auto &ent, auto &pos, auto &vel) { world.query<Position, Velocity>([&](const auto &ent, auto &pos, auto &vel) {
auto &in_position = world.get<Position>(ent); auto &in_position = world.get<Position>(ent);
auto &in_velocity = world.get<Velocity>(ent); auto &in_velocity = world.get<Velocity>(ent);
REQUIRE(pos.location.x >= 0); CHECK(pos.location.x >= 0);
REQUIRE(pos.location.y >= 0); CHECK(pos.location.y >= 0);
REQUIRE(in_position.location.x == pos.location.x); CHECK(in_position.location.x == pos.location.x);
REQUIRE(in_position.location.y == pos.location.y); CHECK(in_position.location.y == pos.location.y);
REQUIRE(in_velocity.x == vel.x); CHECK(in_velocity.x == vel.x);
REQUIRE(in_velocity.y == vel.y); CHECK(in_velocity.y == vel.y);
}); });
} }
enum GUIEvent { enum GUIEvent {
HIT, MISS HIT, MISS
}; };
TEST_CASE("confirm that the event system works", "[ecs]") { void test_confirm_that_the_event_system_works() {
DinkyECS::World world; DinkyECS::World world;
DinkyECS::Entity player = world.entity(); DinkyECS::Entity player = world.entity();
@ -158,18 +164,18 @@ TEST_CASE("confirm that the event system works", "[ecs]") {
// just count down and should get the same number // just count down and should get the same number
while(world.has_event<GUIEvent>()) { while(world.has_event<GUIEvent>()) {
auto [event, entity, data] = world.recv<GUIEvent>(); auto [event, entity, data] = world.recv<GUIEvent>();
REQUIRE(event == GUIEvent::HIT); CHECK(event == GUIEvent::HIT);
REQUIRE(entity == player); CHECK(entity == player);
auto &str_data = std::any_cast<string&>(data); auto &str_data = std::any_cast<string&>(data);
REQUIRE(string{"hello"} == str_data); CHECK(string{"hello"} == str_data);
i--; i--;
} }
REQUIRE(i == 0); CHECK(i == 0);
} }
TEST_CASE("confirm copying and constants", "[ecs-constants]") { void test_confirm_copying_and_constants() {
DinkyECS::World world1; DinkyECS::World world1;
Player player_info{"Zed", world1.entity()}; Player player_info{"Zed", world1.entity()};
@ -184,19 +190,19 @@ TEST_CASE("confirm copying and constants", "[ecs-constants]") {
auto &test1 = world1.get<Position>(player_info.eid); auto &test1 = world1.get<Position>(player_info.eid);
auto &test2 = world2.get<Position>(player_info.eid); auto &test2 = world2.get<Position>(player_info.eid);
REQUIRE(test2.location.x == test1.location.x); CHECK(test2.location.x == test1.location.x);
REQUIRE(test2.location.y == test1.location.y); CHECK(test2.location.y == test1.location.y);
// check for accidental reference // check for accidental reference
test1.location.x = 100; test1.location.x = 100;
REQUIRE(test2.location.x != test1.location.x); CHECK(test2.location.x != test1.location.x);
// test the facts copy over // test the facts copy over
auto &player2 = world2.get_the<Player>(); auto &player2 = world2.get_the<Player>();
REQUIRE(player2.eid == player_info.eid); CHECK(player2.eid == player_info.eid);
} }
TEST_CASE("can destroy all entity", "[ecs-destroy]") { void test_can_destroy_all_entity() {
DinkyECS::World world; DinkyECS::World world;
auto entity = world.entity(); auto entity = world.entity();
@ -206,7 +212,18 @@ TEST_CASE("can destroy all entity", "[ecs-destroy]") {
world.destroy(entity); world.destroy(entity);
REQUIRE(!world.has<Velocity>(entity)); CHECK(!world.has<Velocity>(entity));
REQUIRE(!world.has<Gravity>(entity)); CHECK(!world.has<Gravity>(entity));
REQUIRE(!world.has<Motion>(entity)); CHECK(!world.has<Motion>(entity));
}
fuc2::Set TESTS{
.name="dinkyecs",
.tests={
TEST(test_confirm_ECS_system_works),
TEST(test_confirm_that_the_event_system_works),
TEST(test_confirm_copying_and_constants),
TEST(test_can_destroy_all_entity),
}
};
} }

25
tests/main.cpp Normal file
View file

@ -0,0 +1,25 @@
#include <fuc2/run.hpp>
using namespace fuc2;
TEST_SET(ai_tests);
TEST_SET(animation_tests);
TEST_SET(base_tests);
TEST_SET(battle_tests);
TEST_SET(camera_tests);
TEST_SET(component_tests);
TEST_SET(config_tests);
TEST_SET(dbc_tests);
TEST_SET(dinkyecs_tests);
int main(int argc, char* argv[]) {
run(ai_tests::TESTS);
run(animation_tests::TESTS);
run(base_tests::TESTS);
run(battle_tests::TESTS);
run(camera_tests::TESTS);
run(component_tests::TESTS);
run(config_tests::TESTS);
run(dbc_tests::TESTS);
run(dinkyecs_tests::TESTS);
}

View file

@ -1,12 +1,4 @@
tests = files( tests = files(
'animation.cpp',
'base.cpp',
'battle.cpp',
'camera.cpp',
'components.cpp',
'config.cpp',
'dbc.cpp',
'dinkyecs.cpp',
'event_router.cpp', 'event_router.cpp',
'fsm.cpp', 'fsm.cpp',
'inventory.cpp', 'inventory.cpp',
@ -27,6 +19,14 @@ tests = files(
) )
fuc2_tests = files( fuc2_tests = files(
'dinkyecs.cpp',
'dbc.cpp',
'ai.cpp', 'ai.cpp',
'animation.cpp',
'base.cpp',
'battle.cpp',
'camera.cpp',
'components.cpp',
'config.cpp',
'main.cpp' 'main.cpp'
) )