468e3c44b1
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Has been cancelled
Bigfoot / Clang Format Checks (push) Has been cancelled
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Has been cancelled
75 lines
2.3 KiB
C++
75 lines
2.3 KiB
C++
/*********************************************************************
|
|
* \file AssetLibrary.cpp
|
|
*
|
|
* \author Romain BOULLARD
|
|
* \date July 2026
|
|
*********************************************************************/
|
|
#include <Engine/Asset/AssetLibrary.hpp>
|
|
|
|
#include <AssetsForTesting/Asset/AssetA.hpp>
|
|
#include <AssetsForTesting/Asset/AssetB.hpp>
|
|
#include <AssetsForTesting/Asset/AssetC.hpp>
|
|
#include <gtest/gtest.h>
|
|
|
|
namespace Bigfoot
|
|
{
|
|
class AssetLibraryFixture: public ::testing::Test
|
|
{
|
|
protected:
|
|
void SetUp() override
|
|
{
|
|
std::ignore = m_library.Insert(&m_containerA);
|
|
std::ignore = m_library.Insert(&m_containerB);
|
|
}
|
|
|
|
AssetContainer<AssetA> m_containerA;
|
|
AssetContainer<AssetB> m_containerB;
|
|
|
|
AssetLibrary m_library;
|
|
};
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(AssetLibraryFixture, Insert_ShouldReturnTrueIfTheContainerHasBeenInserted)
|
|
{
|
|
AssetContainer<AssetC> containerC;
|
|
EXPECT_TRUE(m_library.Insert(&containerC));
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(AssetLibraryFixture, Insert_ShouldReturnFalseIfTheContainerHasNotBeenInserted)
|
|
{
|
|
EXPECT_FALSE(m_library.Insert(&m_containerA)); // Duplicate
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(AssetLibraryFixture, Get_ShouldReturnTheContainersIfTheyAreInTheLibrary)
|
|
{
|
|
const AssetContainer<AssetA>* containerA = m_library.Get<AssetA>();
|
|
const AssetContainer<AssetB>* containerB = m_library.Get<AssetB>();
|
|
|
|
EXPECT_EQ(&m_containerA, containerA);
|
|
EXPECT_EQ(&m_containerB, containerB);
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(AssetLibraryFixture, Get_ShouldReturnNullptrIfTheContainersAreNotInTheLibrary)
|
|
{
|
|
const AssetContainer<AssetC>* containerC = m_library.Get<AssetC>();
|
|
|
|
EXPECT_EQ(nullptr, containerC);
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(AssetLibraryFixture, GlobalAssetLibraryShouldHaveAssetsRegistered)
|
|
{
|
|
EXPECT_NE(g_assetLibrary.Get<AssetA>(), nullptr);
|
|
EXPECT_NE(g_assetLibrary.Get<AssetB>(), nullptr);
|
|
EXPECT_NE(g_assetLibrary.Get<AssetC>(), nullptr);
|
|
}
|
|
} // namespace Bigfoot
|