Forgot a ton of files in the last commit.

This commit is contained in:
Zed A. Shaw 2025-05-05 12:11:51 -04:00
parent f5f5ca6431
commit df024adccd
24 changed files with 560 additions and 0 deletions

18
tests/dbc.cpp Normal file
View file

@ -0,0 +1,18 @@
#include <catch2/catch_test_macros.hpp>
#include "dbc.hpp"
using namespace dbc;
TEST_CASE("basic feature tests", "[dbc]") {
log("Logging a message.");
pre("confirm positive cases work", 1 == 1);
pre("confirm positive lambda", [&]{ return 1 == 1;});
post("confirm positive post", 1 == 1);
post("confirm postitive post with lamdba", [&]{ return 1 == 1;});
check(1 == 1, "one equals 1");
}

26
tests/shaders.cpp Normal file
View file

@ -0,0 +1,26 @@
#include <catch2/catch_test_macros.hpp>
#include <fmt/core.h>
#include <string>
#include "shaders.hpp"
using namespace fmt;
TEST_CASE("shader loading/init works", "[shaders]") {
shaders::init();
int version = shaders::version();
std::shared_ptr<sf::Shader> ui_shader = shaders::get("ui_shader");
auto other_test = shaders::get("ui_shader");
REQUIRE(ui_shader != nullptr);
REQUIRE(ui_shader == other_test);
REQUIRE(shaders::updated(version) == false);
int new_version = shaders::reload();
REQUIRE(version != shaders::version());
REQUIRE(version != new_version);
REQUIRE(shaders::version() == new_version);
REQUIRE(shaders::updated(version) == true);
version = new_version;
}

14
tests/sound.cpp Normal file
View file

@ -0,0 +1,14 @@
#include <catch2/catch_test_macros.hpp>
#include <fmt/core.h>
#include <string>
#include "sound.hpp"
using namespace fmt;
TEST_CASE("test sound manager", "[sound]") {
sound::init();
sound::play("blank");
sound::play_at("blank", 0.1, 0.1, 0.1);
}

15
tests/textures.cpp Normal file
View file

@ -0,0 +1,15 @@
#include <catch2/catch_test_macros.hpp>
#include <fmt/core.h>
#include <string>
#include "textures.hpp"
using namespace fmt;
TEST_CASE("test texture management", "[textures]") {
textures::init();
auto spider = textures::get("textures_test");
REQUIRE(spider.sprite != nullptr);
REQUIRE(spider.texture != nullptr);
auto image = textures::load_image("assets/textures_test.png");
}