From 803771dfc4fb5b9144d551a91b77a5a4ec8f21b6 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Thu, 5 Dec 2024 09:51:36 +0100 Subject: add unit test --- src/test/ResourceManagerTest.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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(asset_a); + }); + + EXPECT_THROW({ + resource_manager.get(asset_a); + }, runtime_error); +} + -- cgit v1.2.3