SlotMaps
All checks were successful
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m26s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m20s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 5m42s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 5m37s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m45s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m48s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 7m0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 6m56s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m2s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m51s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 6m29s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 6m31s
Bigfoot / Clang Format Checks (push) Successful in 10s
All checks were successful
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m26s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m20s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 5m42s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 5m37s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m45s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m48s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 7m0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 6m56s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m2s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m51s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 6m29s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 6m31s
Bigfoot / Clang Format Checks (push) Successful in 10s
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_ENGINELOGGER_GENERATED_HPP
|
||||
#define BIGFOOT_ENGINELOGGER_GENERATED_HPP
|
||||
#include <System/Log/Log.hpp>
|
||||
#include <Utils/Log/Log.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@ get_filename_component(PackageName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
project(${PackageName})
|
||||
|
||||
set(PublicDependencies
|
||||
$<$<CONFIG:Debug,RelWithDebInfo>:quill::quill>
|
||||
$<IF:$<BOOL:${ASAN}>,mimalloc-asan,mimalloc-static>
|
||||
stduuid::stduuid)
|
||||
set(PrivateDependencies)
|
||||
set(BigfootPublicDependencies
|
||||
@@ -18,10 +16,3 @@ bigfoot_create_package_lib(
|
||||
"")
|
||||
|
||||
bigfoot_create_logger()
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
$<$<CONFIG:Debug,RelWithDebInfo>:QUILL_NO_EXCEPTIONS>
|
||||
$<$<CONFIG:Debug,RelWithDebInfo>:QUILL_DISABLE_NON_PREFIXED_MACROS>)
|
||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/MimallocImpl.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_SYSTEMLOGGER_GENERATED_HPP
|
||||
#define BIGFOOT_SYSTEMLOGGER_GENERATED_HPP
|
||||
#include <System/Log/Log.hpp>
|
||||
#include <Utils/Log/Log.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ get_filename_component(PackageName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
project(${PackageName})
|
||||
|
||||
set(PublicDependencies
|
||||
$<$<CONFIG:Debug,RelWithDebInfo>:quill::quill>
|
||||
$<IF:$<BOOL:${ASAN}>,mimalloc-asan,mimalloc-static>
|
||||
unordered_dense::unordered_dense)
|
||||
set(PrivateDependencies)
|
||||
set(BigfootPublicDependencies)
|
||||
@@ -12,4 +14,12 @@ bigfoot_create_package_lib(
|
||||
"${PrivateLibraries}"
|
||||
"${BigfootPublicDependencies}"
|
||||
"${BigfootPrivateDependencies}"
|
||||
"")
|
||||
"")
|
||||
set_source_files_properties(../Utils/MimallocImpl.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
||||
|
||||
bigfoot_create_logger()
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
$<$<CONFIG:Debug,RelWithDebInfo>:QUILL_NO_EXCEPTIONS>
|
||||
$<$<CONFIG:Debug,RelWithDebInfo>:QUILL_DISABLE_NON_PREFIXED_MACROS>)
|
||||
@@ -6,7 +6,7 @@
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_UTILS_ASSERT_HPP
|
||||
#define BIGFOOT_UTILS_ASSERT_HPP
|
||||
#include <System/Log/Log.hpp>
|
||||
#include <Utils/Log/Log.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
|
||||
@@ -6,5 +6,217 @@
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_UTILS_CONTAINERS_SLOTMAP_HPP
|
||||
#define BIGFOOT_UTILS_CONTAINERS_SLOTMAP_HPP
|
||||
#include <Utils/UtilsAssertHandler.hpp>
|
||||
|
||||
#include <EASTL/vector.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
template<class TYPE>
|
||||
class SlotMap
|
||||
{
|
||||
private:
|
||||
using IndexType = std::uint32_t;
|
||||
using VersionType = std::uint32_t;
|
||||
|
||||
public:
|
||||
struct SlotKey
|
||||
{
|
||||
VersionType m_version = 0;
|
||||
IndexType m_index = 0;
|
||||
|
||||
bool Invalid() const
|
||||
{
|
||||
return m_version == 0;
|
||||
}
|
||||
|
||||
bool operator==(const SlotKey p_key) const
|
||||
{
|
||||
return m_version == p_key.m_version && m_index == p_key.m_index;
|
||||
}
|
||||
};
|
||||
|
||||
SlotMap():
|
||||
m_freeSlotHead(std::numeric_limits<IndexType>::max())
|
||||
{
|
||||
}
|
||||
|
||||
SlotMap(const SlotMap& p_slotMap) = default;
|
||||
SlotMap(SlotMap&& p_slotMap) = default;
|
||||
|
||||
template<class... ARGS>
|
||||
SlotKey Insert(ARGS&&... p_args)
|
||||
{
|
||||
ASSERT(UtilsAssertHandler,
|
||||
m_data.size() < std::numeric_limits<IndexType>::max(),
|
||||
"Too many elements for SlotMap!");
|
||||
|
||||
m_data.emplace_back(std::forward<ARGS>(p_args)...);
|
||||
|
||||
if (m_freeSlotHead != std::numeric_limits<IndexType>::max())
|
||||
{
|
||||
const IndexType freeSlotIndex = m_freeSlotHead;
|
||||
m_freeSlotHead = m_slots[freeSlotIndex].m_index;
|
||||
|
||||
const VersionType version = m_slots[freeSlotIndex].m_version;
|
||||
m_slots[freeSlotIndex] = {.m_version = version, .m_index = static_cast<IndexType>(m_data.size()) - 1};
|
||||
m_dataToSlots.push_back(freeSlotIndex);
|
||||
|
||||
return {.m_version = version, .m_index = freeSlotIndex};
|
||||
}
|
||||
|
||||
const IndexType newSlotIndex = m_slots.size();
|
||||
m_slots.push_back({.m_version = 1, .m_index = static_cast<IndexType>(m_data.size()) - 1});
|
||||
m_dataToSlots.push_back(newSlotIndex);
|
||||
|
||||
return {.m_version = 1, .m_index = newSlotIndex};
|
||||
}
|
||||
|
||||
void Remove(const SlotKey p_key)
|
||||
{
|
||||
const IndexType slotIndex = p_key.m_index;
|
||||
if (slotIndex >= m_slots.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (p_key.m_version != m_slots[slotIndex].m_version)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const IndexType dataIndex = m_slots[slotIndex].m_index;
|
||||
m_data.erase_unsorted(m_data.begin() + dataIndex);
|
||||
m_dataToSlots.erase_unsorted(m_dataToSlots.begin() + dataIndex);
|
||||
|
||||
if (dataIndex < m_data.size())
|
||||
{
|
||||
const IndexType movedSlotIndex = m_dataToSlots[dataIndex];
|
||||
m_slots[movedSlotIndex].m_index = dataIndex;
|
||||
}
|
||||
|
||||
m_slots[slotIndex] = {.m_version = p_key.m_version + 1, .m_index = m_freeSlotHead};
|
||||
m_freeSlotHead = slotIndex;
|
||||
}
|
||||
|
||||
TYPE* Get(const SlotKey p_key)
|
||||
{
|
||||
const IndexType slotIndex = p_key.m_index;
|
||||
if (slotIndex >= m_slots.size())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
if (p_key.m_version != m_slots[slotIndex].m_version)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return &m_data[m_slots[slotIndex].m_index];
|
||||
}
|
||||
|
||||
const TYPE* Get(const SlotKey p_key) const
|
||||
{
|
||||
const IndexType slotIndex = p_key.m_index;
|
||||
if (slotIndex >= m_slots.size())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
if (p_key.m_version != m_slots[slotIndex].m_version)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return &m_data[m_slots[slotIndex].m_index];
|
||||
}
|
||||
|
||||
void Reserve(const std::uint32_t p_size)
|
||||
{
|
||||
m_data.reserve(p_size);
|
||||
m_slots.reserve(p_size);
|
||||
m_dataToSlots.reserve(p_size);
|
||||
}
|
||||
|
||||
typename eastl::vector<TYPE>::size_type Size() const
|
||||
{
|
||||
return m_data.size();
|
||||
}
|
||||
|
||||
typename eastl::vector<TYPE>::size_type Capacity() const
|
||||
{
|
||||
return m_data.capacity();
|
||||
}
|
||||
|
||||
bool Empty() const
|
||||
{
|
||||
return m_data.empty();
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
m_data.clear();
|
||||
m_dataToSlots.clear();
|
||||
|
||||
for (IndexType i = 0; i < m_slots.size(); ++i)
|
||||
{
|
||||
const VersionType newVersion = m_slots[i].m_version + 1;
|
||||
const IndexType nextFree = i + 1 < static_cast<IndexType>(m_slots.size())
|
||||
? i + 1
|
||||
: std::numeric_limits<IndexType>::max();
|
||||
m_slots[i] = {.m_version = newVersion, .m_index = nextFree};
|
||||
}
|
||||
|
||||
m_freeSlotHead = m_slots.empty() ? std::numeric_limits<IndexType>::max() : 0;
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
m_data.clear();
|
||||
m_slots.clear();
|
||||
m_dataToSlots.clear();
|
||||
m_freeSlotHead = std::numeric_limits<IndexType>::max();
|
||||
}
|
||||
|
||||
typename eastl::vector<TYPE>::iterator begin()
|
||||
{
|
||||
return m_data.begin();
|
||||
}
|
||||
|
||||
typename eastl::vector<TYPE>::iterator end()
|
||||
{
|
||||
return m_data.end();
|
||||
}
|
||||
|
||||
typename eastl::vector<TYPE>::const_iterator begin() const
|
||||
{
|
||||
return m_data.begin();
|
||||
}
|
||||
|
||||
typename eastl::vector<TYPE>::const_iterator end() const
|
||||
{
|
||||
return m_data.end();
|
||||
}
|
||||
|
||||
typename eastl::vector<TYPE>::const_iterator cbegin() const
|
||||
{
|
||||
return m_data.cbegin();
|
||||
}
|
||||
|
||||
typename eastl::vector<TYPE>::const_iterator cend() const
|
||||
{
|
||||
return m_data.cend();
|
||||
}
|
||||
|
||||
~SlotMap() = default;
|
||||
|
||||
SlotMap& operator=(const SlotMap& p_slotMap) = default;
|
||||
SlotMap& operator=(SlotMap&& p_slotMap) = default;
|
||||
|
||||
private:
|
||||
eastl::vector<TYPE> m_data;
|
||||
eastl::vector<IndexType> m_dataToSlots;
|
||||
eastl::vector<SlotKey> m_slots;
|
||||
|
||||
IndexType m_freeSlotHead;
|
||||
};
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
* \author Romain BOULLARD
|
||||
* \date October 2025
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_SYSTEM_LOG_HPP
|
||||
#define BIGFOOT_SYSTEM_LOG_HPP
|
||||
#include <System/Log/EASTLFormatters.hpp>
|
||||
#ifndef BIGFOOT_UTILS_LOG_HPP
|
||||
#define BIGFOOT_UTILS_LOG_HPP
|
||||
#include <Utils/Log/EASTLFormatters.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
#include <System/Log/Log_generated.hpp>
|
||||
|
||||
#include <Utils/Log/Log_generated.hpp>
|
||||
#include <Utils/Singleton.hpp>
|
||||
|
||||
#include <EASTL/array.h>
|
||||
@@ -6,7 +6,7 @@
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_@LOGGER_FILENAME_UPPER@_GENERATED_HPP
|
||||
#define BIGFOOT_@LOGGER_FILENAME_UPPER@_GENERATED_HPP
|
||||
#include <System/Log/Log.hpp>
|
||||
#include <Utils/Log/Log.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* \author Romain BOULLARD
|
||||
* \date October 2025
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_CONCAT_PROFILER_HPP
|
||||
#define BIGFOOT_CONCAT_PROFILER_HPP
|
||||
#ifndef BIGFOOT_UTILS_PROFILER_HPP
|
||||
#define BIGFOOT_UTILS_PROFILER_HPP
|
||||
|
||||
#ifdef TRACY
|
||||
#include <tracy/Tracy.hpp>
|
||||
56
Bigfoot/Sources/Utils/Include/Utils/UtilsAssertHandler.hpp
Normal file
56
Bigfoot/Sources/Utils/Include/Utils/UtilsAssertHandler.hpp
Normal file
@@ -0,0 +1,56 @@
|
||||
/*********************************************************************
|
||||
* \file UtilsAssertHandler.hpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date May 2026
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_UTILS_UTILSASSERTHANDLER_HPP
|
||||
#define BIGFOOT_UTILS_UTILSASSERTHANDLER_HPP
|
||||
#include <Utils/Assert.hpp>
|
||||
#include <Utils/Log/Log.hpp>
|
||||
|
||||
#include <Utils/UtilsLogger_generated.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
#include <EASTL/utility.h>
|
||||
|
||||
#include <format>
|
||||
#include <source_location>
|
||||
#include <string_view>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
class UtilsAssertHandler
|
||||
{
|
||||
public:
|
||||
UtilsAssertHandler() = delete;
|
||||
|
||||
UtilsAssertHandler(const UtilsAssertHandler& p_handler) = delete;
|
||||
UtilsAssertHandler(UtilsAssertHandler&& p_handler) = delete;
|
||||
|
||||
~UtilsAssertHandler() = delete;
|
||||
|
||||
/**
|
||||
* Handle an assertion.
|
||||
*
|
||||
* \param p_location Location of the assertion.
|
||||
* \param p_format Format string for the assertion message.
|
||||
* \param p_args Arguments for the format string.
|
||||
*/
|
||||
template<typename... ARGS>
|
||||
static void Handle(const std::source_location& p_location, std::format_string<ARGS...> p_format, ARGS&&... p_args)
|
||||
{
|
||||
BIGFOOT_LOG_FATAL(UTILS_LOGGER,
|
||||
"Assert: {} (File:{}, Line:{}, Function:{}\n",
|
||||
std::format(p_format, std::forward<ARGS>(p_args)...),
|
||||
p_location.file_name(),
|
||||
p_location.line(),
|
||||
p_location.function_name());
|
||||
}
|
||||
|
||||
UtilsAssertHandler& operator=(const UtilsAssertHandler& p_handler) = delete;
|
||||
UtilsAssertHandler& operator=(UtilsAssertHandler&& p_handler) = delete;
|
||||
};
|
||||
} // namespace Bigfoot
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,12 +1,12 @@
|
||||
// AUTO-GENERATED DO NOT TOUCH
|
||||
|
||||
/*********************************************************************
|
||||
* \file SystemTestsLogger.generated.hpp
|
||||
* \file UtilsLogger.generated.hpp
|
||||
*
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_SYSTEMTESTSLOGGER_GENERATED_HPP
|
||||
#define BIGFOOT_SYSTEMTESTSLOGGER_GENERATED_HPP
|
||||
#include <System/Log/Log.hpp>
|
||||
#ifndef BIGFOOT_UTILSLOGGER_GENERATED_HPP
|
||||
#define BIGFOOT_UTILSLOGGER_GENERATED_HPP
|
||||
#include <Utils/Log/Log.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Bigfoot
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
inline Log::LoggerInfo SYSTEMTESTS_LOGGER {"SYSTEMTESTS_LOGGER", Flat::LogLevel::Trace};
|
||||
inline Log::LoggerInfo UTILS_LOGGER {"UTILS_LOGGER", Flat::LogLevel::Trace};
|
||||
} // namespace Bigfoot
|
||||
#endif
|
||||
#endif
|
||||
@@ -4,7 +4,7 @@
|
||||
* \author Romain BOULLARD
|
||||
* \date October 2025
|
||||
*********************************************************************/
|
||||
#include <System/Log/Log.hpp>
|
||||
#include <Utils/Log/Log.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* \author Romain BOULLARD
|
||||
* \date October 2025
|
||||
*********************************************************************/
|
||||
#include <System/Profiler.hpp>
|
||||
#include <Utils/Profiler.hpp>
|
||||
|
||||
#if defined BIGFOOT_WINDOWS
|
||||
#pragma comment(linker, "/include:mi_version")
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
#include <Engine/EngineLogger_generated.hpp>
|
||||
|
||||
#include <System/Log/Log.hpp>
|
||||
|
||||
#include <Utils/Log/Log.hpp>
|
||||
#include <Utils/Singleton.hpp>
|
||||
#include <Utils/TargetMacros.h>
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
#include <Engine/EngineLogger_generated.hpp>
|
||||
|
||||
#include <System/Log/Log.hpp>
|
||||
#include <System/Time/Time.hpp>
|
||||
#include <System/UUID/UUID.hpp>
|
||||
|
||||
#include <Utils/Log/Log.hpp>
|
||||
#include <Utils/Singleton.hpp>
|
||||
#include <Utils/TargetMacros.h>
|
||||
|
||||
|
||||
@@ -7,6 +7,4 @@ set(BigfootDependencies
|
||||
|
||||
bigfoot_create_package_tests(
|
||||
""
|
||||
"${BigfootDependencies}")
|
||||
|
||||
bigfoot_create_logger()
|
||||
"${BigfootDependencies}")
|
||||
@@ -6,4 +6,6 @@ set(BigfootDependencies
|
||||
|
||||
bigfoot_create_package_tests(
|
||||
""
|
||||
"${BigfootDependencies}")
|
||||
"${BigfootDependencies}")
|
||||
|
||||
bigfoot_create_logger()
|
||||
@@ -13,7 +13,26 @@ namespace Bigfoot
|
||||
class SlotMapFixture: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
SlotMap<std::uint32_t> m_slotMap;
|
||||
};
|
||||
|
||||
TEST_F(SlotMapFixture, Insert)
|
||||
{
|
||||
const SlotMap<std::uint32_t>::SlotKey firstKey = m_slotMap.Insert(64);
|
||||
const SlotMap<std::uint32_t>::SlotKey secondKey = m_slotMap.Insert(2);
|
||||
const SlotMap<std::uint32_t>::SlotKey thirdKey = m_slotMap.Insert(42);
|
||||
|
||||
m_slotMap.Remove(secondKey);
|
||||
m_slotMap.Remove(firstKey);
|
||||
|
||||
const SlotMap<std::uint32_t>::SlotKey fourthKey = m_slotMap.Insert(3);
|
||||
const SlotMap<std::uint32_t>::SlotKey fifthKey = m_slotMap.Insert(65);
|
||||
|
||||
EXPECT_EQ(m_slotMap.Get(firstKey), nullptr);
|
||||
EXPECT_EQ(m_slotMap.Get(secondKey), nullptr);
|
||||
EXPECT_EQ(*m_slotMap.Get(thirdKey), 42);
|
||||
EXPECT_EQ(*m_slotMap.Get(fourthKey), 3);
|
||||
EXPECT_EQ(*m_slotMap.Get(fifthKey), 65);
|
||||
EXPECT_EQ(m_slotMap.Get(SlotMap<std::uint32_t>::SlotKey {}), nullptr);
|
||||
}
|
||||
} // namespace Bigfoot
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// AUTO-GENERATED DO NOT TOUCH
|
||||
|
||||
/*********************************************************************
|
||||
* \file UtilsTestsLogger.generated.hpp
|
||||
*
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_UTILSTESTSLOGGER_GENERATED_HPP
|
||||
#define BIGFOOT_UTILSTESTSLOGGER_GENERATED_HPP
|
||||
#include <Utils/Log/Log.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
inline Log::LoggerInfo UTILSTESTS_LOGGER {"UTILSTESTS_LOGGER", Flat::LogLevel::Trace};
|
||||
} // namespace Bigfoot
|
||||
#endif
|
||||
#endif
|
||||
@@ -4,11 +4,11 @@
|
||||
* \author Romain BOULLARD
|
||||
* \date December 2022
|
||||
*********************************************************************/
|
||||
#include <System/Log/Log.hpp>
|
||||
#include <Utils/Log/Log.hpp>
|
||||
|
||||
#include <Utils/Singleton.hpp>
|
||||
|
||||
#include <SystemTests/SystemTestsLogger_generated.hpp>
|
||||
#include <UtilsTests/UtilsTestsLogger_generated.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
@@ -21,7 +21,7 @@ class LogFixture: public ::testing::Test
|
||||
protected:
|
||||
void SetUp() override
|
||||
{
|
||||
SYSTEMTESTS_LOGGER = {"UTILSTESTS_LOGGER", Flat::LogLevel::Trace};
|
||||
UTILSTESTS_LOGGER = {"UTILSTESTS_LOGGER", Flat::LogLevel::Trace};
|
||||
}
|
||||
|
||||
static constexpr Flat::LogLevel QuillLogLevelToLogLevel(const quill::LogLevel p_level)
|
||||
@@ -54,18 +54,18 @@ class LogFixture: public ::testing::Test
|
||||
|
||||
TEST_F(LogFixture, RegisterLogger_ShouldRegisterTheLogger)
|
||||
{
|
||||
const quill::Logger* logger = m_log.RegisterLogger(SYSTEMTESTS_LOGGER);
|
||||
const quill::Logger* logger = m_log.RegisterLogger(UTILSTESTS_LOGGER);
|
||||
EXPECT_TRUE(logger);
|
||||
EXPECT_EQ(logger, m_log.GetLogger(SYSTEMTESTS_LOGGER));
|
||||
EXPECT_EQ(logger->get_logger_name(), SYSTEMTESTS_LOGGER.m_name);
|
||||
EXPECT_EQ(QuillLogLevelToLogLevel(logger->get_log_level()), SYSTEMTESTS_LOGGER.m_level);
|
||||
EXPECT_EQ(logger, m_log.GetLogger(UTILSTESTS_LOGGER));
|
||||
EXPECT_EQ(logger->get_logger_name(), UTILSTESTS_LOGGER.m_name);
|
||||
EXPECT_EQ(QuillLogLevelToLogLevel(logger->get_log_level()), UTILSTESTS_LOGGER.m_level);
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(LogFixture, GetLogger_ShouldReturnNullptrIfTheLoggerDoesNotExist)
|
||||
{
|
||||
EXPECT_FALSE(m_log.GetLogger(SYSTEMTESTS_LOGGER));
|
||||
EXPECT_FALSE(m_log.GetLogger(UTILSTESTS_LOGGER));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
@@ -73,17 +73,17 @@ TEST_F(LogFixture, GetLogger_ShouldReturnNullptrIfTheLoggerDoesNotExist)
|
||||
TEST_F(LogFixture, GetLogger_ShouldReturnTheLoggerIfItExists)
|
||||
{
|
||||
[[maybe_unused]]
|
||||
const quill::Logger* logger = m_log.RegisterLogger(SYSTEMTESTS_LOGGER);
|
||||
EXPECT_TRUE(m_log.GetLogger(SYSTEMTESTS_LOGGER));
|
||||
const quill::Logger* logger = m_log.RegisterLogger(UTILSTESTS_LOGGER);
|
||||
EXPECT_TRUE(m_log.GetLogger(UTILSTESTS_LOGGER));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(LogFixture, ChangeLoggerLogLevel_ShouldChangeTheLoggerLogLevel)
|
||||
{
|
||||
const quill::Logger* logger = m_log.RegisterLogger(SYSTEMTESTS_LOGGER);
|
||||
const quill::Logger* logger = m_log.RegisterLogger(UTILSTESTS_LOGGER);
|
||||
|
||||
m_log.ChangeLoggerLogLevel(SYSTEMTESTS_LOGGER, Flat::LogLevel::Critical);
|
||||
m_log.ChangeLoggerLogLevel(UTILSTESTS_LOGGER, Flat::LogLevel::Critical);
|
||||
EXPECT_EQ(QuillLogLevelToLogLevel(logger->get_log_level()), Flat::LogLevel::Critical);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ TEST_F(LogFixture, ChangeLoggerLogLevel_ShouldChangeTheLoggerLogLevel)
|
||||
TEST_F(LogFixture, LogDebug)
|
||||
{
|
||||
Singleton<Log>::Lifetime singletonLifetime;
|
||||
BIGFOOT_LOG_DEBUG(SYSTEMTESTS_LOGGER, "Hello");
|
||||
BIGFOOT_LOG_DEBUG(UTILSTESTS_LOGGER, "Hello");
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
@@ -100,7 +100,7 @@ TEST_F(LogFixture, LogDebug)
|
||||
TEST_F(LogFixture, LogTrace)
|
||||
{
|
||||
Singleton<Log>::Lifetime singletonLifetime;
|
||||
BIGFOOT_LOG_TRACE(SYSTEMTESTS_LOGGER, "Hello");
|
||||
BIGFOOT_LOG_TRACE(UTILSTESTS_LOGGER, "Hello");
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
@@ -108,7 +108,7 @@ TEST_F(LogFixture, LogTrace)
|
||||
TEST_F(LogFixture, LogInfo)
|
||||
{
|
||||
Singleton<Log>::Lifetime singletonLifetime;
|
||||
BIGFOOT_LOG_INFO(SYSTEMTESTS_LOGGER, "Hello");
|
||||
BIGFOOT_LOG_INFO(UTILSTESTS_LOGGER, "Hello");
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
@@ -116,7 +116,7 @@ TEST_F(LogFixture, LogInfo)
|
||||
TEST_F(LogFixture, LogWarn)
|
||||
{
|
||||
Singleton<Log>::Lifetime singletonLifetime;
|
||||
BIGFOOT_LOG_WARN(SYSTEMTESTS_LOGGER, "Hello");
|
||||
BIGFOOT_LOG_WARN(UTILSTESTS_LOGGER, "Hello");
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
@@ -124,7 +124,7 @@ TEST_F(LogFixture, LogWarn)
|
||||
TEST_F(LogFixture, LogError)
|
||||
{
|
||||
Singleton<Log>::Lifetime singletonLifetime;
|
||||
BIGFOOT_LOG_ERROR(SYSTEMTESTS_LOGGER, "Hello");
|
||||
BIGFOOT_LOG_ERROR(UTILSTESTS_LOGGER, "Hello");
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
@@ -132,7 +132,7 @@ TEST_F(LogFixture, LogError)
|
||||
TEST_F(LogFixture, LogFatal)
|
||||
{
|
||||
Singleton<Log>::Lifetime singletonLifetime;
|
||||
BIGFOOT_LOG_FATAL(SYSTEMTESTS_LOGGER, "Hello");
|
||||
BIGFOOT_LOG_FATAL(UTILSTESTS_LOGGER, "Hello");
|
||||
}
|
||||
} // namespace Bigfoot
|
||||
#endif
|
||||
@@ -2,7 +2,7 @@ function(bigfoot_create_logger)
|
||||
set(LOGGER_FILENAME ${PROJECT_NAME}Logger)
|
||||
string(TOUPPER ${PROJECT_NAME}_Logger LOGGER_NAME)
|
||||
string(TOUPPER ${LOGGER_FILENAME} LOGGER_FILENAME_UPPER)
|
||||
configure_file( ${CMAKE_SOURCE_DIR}/Bigfoot/Sources/System/Include/System/Log/TargetLogger_generated.hpp.in
|
||||
configure_file( ${CMAKE_SOURCE_DIR}/Bigfoot/Sources/Utils/Include/Utils/Log/TargetLogger_generated.hpp.in
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Include/${PROJECT_NAME}/${LOGGER_FILENAME}_generated.hpp
|
||||
@ONLY)
|
||||
endfunction()
|
||||
|
||||
Reference in New Issue
Block a user