aboutsummaryrefslogtreecommitdiff
path: root/src/test/AssetTest.cpp
blob: f41e9de17a7c639ee8a1a6f114c6c931b4e4392a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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());
}