Files
Bigfoot/Bigfoot/Tests/Engine/DataAccessor/DataAccessor.cpp
T
rboullard be85c650b9
Bigfoot / Sonarqube (push) Skipped
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 32s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 31s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 29s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 21s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 23s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 51s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 40s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 53s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 43s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 30s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 22s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 43s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 43s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 36s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 23s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 51s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 53s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 25s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 21s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 36s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 31s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 36s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 34s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 40s
Bigfoot / Clang Format Checks (push) Failing after 10s
More optimizations for BigFile
2026-08-25 22:22:23 +02:00

79 lines
2.5 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::optional<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(eastl::optional<AssetMetadata>, GetAssetMetadata, (const UUID& p_uuid), (const, override));
MOCK_METHOD(eastl::vector<AssetMetadata>,
GetAssetMetadatas,
(eastl::span<const UUID> p_uuids),
(const, override));
MOCK_METHOD(void,
SaveAssetFlatbuffer,
(const AssetMetadata& p_metaData, const eastl::span<const std::byte> p_flatbuffer),
(override));
MOCK_METHOD(void,
SaveAssetFlatbuffers,
(eastl::span<const AssetMetadata> p_metadatas,
eastl::span<const eastl::vector<std::byte>> p_flatbuffers),
(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