diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-05 09:51:36 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-05 09:51:39 +0100 |
commit | 803771dfc4fb5b9144d551a91b77a5a4ec8f21b6 (patch) | |
tree | 329a6a5c10584044a8e394665049b23397b02417 | |
parent | 84c5900445cc0ce8ab2fe8befc5050ff99def01e (diff) |
add unit test
-rw-r--r-- | src/test/ResourceManagerTest.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ResourceManagerTest.cpp b/src/test/ResourceManagerTest.cpp index b6be3c0..0789ef0 100644 --- a/src/test/ResourceManagerTest.cpp +++ b/src/test/ResourceManagerTest.cpp @@ -17,6 +17,10 @@ class ResourceManagerTest : public Test { public: ResourceManager resource_manager{mediator}; + class Unrelated : public Resource { + using Resource::Resource; + }; + Asset asset_a{"asset/texture/img.png"}; Asset asset_b{"asset/texture/ERROR.png"}; @@ -69,3 +73,14 @@ TEST_F(ResourceManagerTest, Persistent) { resource_manager.clear_all(); EXPECT_EQ(TestResource::instances, 0); } + +TEST_F(ResourceManagerTest, UnmatchedType) { + EXPECT_NO_THROW({ + resource_manager.get<TestResource>(asset_a); + }); + + EXPECT_THROW({ + resource_manager.get<Unrelated>(asset_a); + }, runtime_error); +} + |