Bigfoot / Sonarqube (push) Skipped
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 42s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Failing after 1m1s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Failing after 48s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 36s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 32s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 24s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Failing after 36s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Failing after 26s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 57s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 24s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Failing after 37s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Failing after 28s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 55s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 45s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Failing after 1m0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Failing after 50s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 31s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 23s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 45s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 39s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 41s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 37s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 44s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 38s
Bigfoot / Clang Format Checks (push) Successful in 11s
84 lines
2.9 KiB
C++
84 lines
2.9 KiB
C++
/*********************************************************************
|
|
* \file DataAccessor.cpp
|
|
*
|
|
* \author Romain BOULLARD
|
|
* \date August 2026
|
|
*********************************************************************/
|
|
#include <Engine/DataAccessor/DataAccessor.hpp>
|
|
|
|
#include <gmock/gmock.h>
|
|
#include <gtest/gtest.h>
|
|
|
|
namespace Bigfoot
|
|
{
|
|
class DataAccessorFixture: public ::testing::Test
|
|
{
|
|
protected:
|
|
class DataAccessorMock: public DataAccessor
|
|
{
|
|
public:
|
|
MOCK_METHOD(eastl::vector<std::byte>, GetAssetFlatbuffer, (const UUID& p_uuid), (const, override));
|
|
MOCK_METHOD(eastl::vector<eastl::vector<std::byte>>,
|
|
GetAssetFlatbuffers,
|
|
(eastl::span<const UUID> p_uuids),
|
|
(const, override));
|
|
MOCK_METHOD(AssetMetadata, GetAssetMetadata, (const UUID& p_uuid), (const, override));
|
|
MOCK_METHOD(eastl::vector<AssetMetadata>,
|
|
GetAssetMetadatas,
|
|
(eastl::span<const UUID> p_uuids),
|
|
(const, override));
|
|
MOCK_METHOD(eastl::vector<UUID>, GetAssetHardReferences, (const UUID& p_uuid), (const, override));
|
|
MOCK_METHOD(eastl::vector<eastl::vector<UUID>>,
|
|
GetAssetsHardReferences,
|
|
(const eastl::span<const UUID> p_uuids),
|
|
(const, override));
|
|
MOCK_METHOD(void,
|
|
SaveAssetFlatbuffer,
|
|
(const AssetMetadata& p_metaData,
|
|
const eastl::span<const std::byte> p_flatbuffer,
|
|
const eastl::span<const UUID> p_hardReferences),
|
|
(override));
|
|
MOCK_METHOD(void,
|
|
SaveAssetFlatbuffers,
|
|
(eastl::span<const AssetMetadata> p_metadatas,
|
|
eastl::span<const eastl::vector<std::byte>> p_flatbuffers,
|
|
eastl::span<const eastl::vector<UUID>> p_hardReferences),
|
|
(override));
|
|
MOCK_METHOD(bool, Has, (const UUID& p_uuid), (const, override));
|
|
};
|
|
|
|
void SetUp() override
|
|
{
|
|
m_original = g_dataAccessor;
|
|
}
|
|
|
|
void TearDown() override
|
|
{
|
|
SetDataAccessor(m_original);
|
|
}
|
|
|
|
DataAccessorMock m_accessor;
|
|
DataAccessor* m_original;
|
|
};
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(DataAccessorFixture, SetDataAccessor_ShouldSetTheDataAccessor)
|
|
{
|
|
SetDataAccessor(&m_accessor);
|
|
EXPECT_EQ(g_dataAccessor, &m_accessor);
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(DataAccessorFixture, ScopedDataAccessor_ShouldChangeTheDataAccessorInAScopedWay)
|
|
{
|
|
EXPECT_EQ(g_dataAccessor, nullptr);
|
|
{
|
|
ScopedDataAccessor dataAccessor {&m_accessor};
|
|
EXPECT_EQ(g_dataAccessor, &m_accessor);
|
|
}
|
|
EXPECT_EQ(g_dataAccessor, nullptr);
|
|
}
|
|
} // namespace Bigfoot
|