diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-14 13:57:13 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-14 13:57:13 +0100 |
commit | 07adbf48e0781cd8c95983c1871a84b6160ee5bf (patch) | |
tree | e3a55673b20ebaa3baec6665c107c177bd59ff14 /src/test/AssetTest.cpp | |
parent | 01c09a196c3f3e5cefaa4119a95a1cdeb7b9c263 (diff) |
implement asset + more WIP audio system
Diffstat (limited to 'src/test/AssetTest.cpp')
-rw-r--r-- | src/test/AssetTest.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/test/AssetTest.cpp b/src/test/AssetTest.cpp new file mode 100644 index 0000000..c3ff158 --- /dev/null +++ b/src/test/AssetTest.cpp @@ -0,0 +1,33 @@ +#include "api/Config.h" +#include <gtest/gtest.h> + +#include <crepe/Asset.h> + +using namespace std; +using namespace crepe; +using namespace testing; + +class AssetTest : public Test { +public: + Config & cfg = Config::get_instance(); + void SetUp() override { + this->cfg.asset.root_pattern = ".crepe-root"; + } +}; + +TEST_F(AssetTest, Existant) { + ASSERT_NO_THROW(Asset{"asset/texture/img.png"}); +} + +TEST_F(AssetTest, Nonexistant) { + ASSERT_ANY_THROW(Asset{"asset/nonexistant"}); +} + +TEST_F(AssetTest, Rootless) { + cfg.asset.root_pattern.clear(); + + string arbitrary = "\\/this is / /../passed through as-is"; + Asset asset{arbitrary}; + ASSERT_EQ(arbitrary, asset.get_path()); +} + |