diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-11-24 22:12:31 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-11-24 22:12:31 +0100 |
commit | 24e3f0ea7c5ce90af1276dca49644b5e1ac799f6 (patch) | |
tree | 465dd020c1700511a1697267268b3d975caefd48 /src/test/AssetTest.cpp | |
parent | 6287d4e9068d8bd27a9e62643f54adb69e84befd (diff) | |
parent | be5ccbe24086d5d4fb407f268c649dcbc36eda6b (diff) |
merge
Diffstat (limited to 'src/test/AssetTest.cpp')
-rw-r--r-- | src/test/AssetTest.cpp | 21 |
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()); +} |