aboutsummaryrefslogtreecommitdiff
path: root/src/test/AssetTest.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-02 18:55:13 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-02 18:55:13 +0100
commit47e6d987ced269ec16ea455706513025cb9c50c5 (patch)
tree5cb48ad8565f7c5bd8b03624bc716375b8d2321b /src/test/AssetTest.cpp
parentf23eaa64df8b0ef27f58b1632c5e659fe3737153 (diff)
parent647eb8e318f1ed1e3ec18505ea4df57025e6ffd5 (diff)
Merge branch 'master' into niels/rendering_color
Diffstat (limited to 'src/test/AssetTest.cpp')
-rw-r--r--src/test/AssetTest.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/AssetTest.cpp b/src/test/AssetTest.cpp
new file mode 100644
index 0000000..93fd6a9
--- /dev/null
+++ b/src/test/AssetTest.cpp
@@ -0,0 +1,21 @@
+#include <gtest/gtest.h>
+
+#include <crepe/api/Asset.h>
+#include <crepe/api/Config.h>
+
+using namespace std;
+using namespace crepe;
+using namespace testing;
+
+TEST(AssetTest, Existant) { ASSERT_NO_THROW(Asset{"asset/texture/img.png"}); }
+
+TEST(AssetTest, Nonexistant) { ASSERT_ANY_THROW(Asset{"asset/nonexistant"}); }
+
+TEST(AssetTest, Rootless) {
+ Config & cfg = Config::get_instance();
+ cfg.asset.root_pattern.clear();
+
+ string arbitrary = "\\/this is / /../passed through as-is";
+ Asset asset{arbitrary};
+ ASSERT_EQ(arbitrary, asset.get_path());
+}