9 Commits

Author SHA1 Message Date
3f02f47ee4 Maintenance
All checks were successful
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m51s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m31s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 6m17s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 6m14s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m28s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 6m28s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 8m1s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 7m43s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m12s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 6m18s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 7m24s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 7m17s
Bigfoot / Clang Format Checks (push) Successful in 12s
2026-05-17 16:12:32 +02:00
8685f3d1dd Formatting
All checks were successful
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m48s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m32s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 6m17s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 6m14s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m20s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 6m21s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 7m50s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 7m49s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m20s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 6m24s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 7m34s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 7m23s
Bigfoot / Clang Format Checks (push) Successful in 2m0s
2026-05-17 12:54:44 +02:00
3fe5c31fc0 Use gtest recommandation and provide global environment through main
Some checks failed
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m14s
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: ON) (push) Has been cancelled
2026-05-17 12:47:34 +02:00
8996adec61 Fix logging environment causing pointer corruption
Some checks failed
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m46s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m30s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 6m16s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 6m14s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m27s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 6m23s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 7m40s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 7m49s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m13s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 6m13s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 7m21s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 7m10s
Bigfoot / Clang Format Checks (push) Failing after 12s
2026-05-16 22:10:25 +02:00
2003121d07 Logging changes
Some checks failed
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m39s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m30s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Failing after 5m47s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Failing after 5m39s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m20s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 6m28s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Failing after 7m14s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Failing after 7m11s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m19s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 6m14s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 7m19s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 7m21s
Bigfoot / Clang Format Checks (push) Failing after 11s
2026-05-16 20:04:32 +02:00
902ef87e1d Environment for tests
Some checks failed
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m47s
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: ON) (push) Has been cancelled
2026-05-16 19:56:54 +02:00
9bea52973b Maintenance
Some checks failed
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m34s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m32s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 6m13s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 6m9s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m24s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 6m23s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 7m38s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Failing after 6m56s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m13s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 6m8s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 7m31s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 7m15s
Bigfoot / Clang Format Checks (push) Failing after 12s
2026-05-16 17:48:43 +02:00
a343d65598 Maintenance
Some checks failed
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Failing after 5m22s
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: ON) (push) Has been cancelled
2026-05-16 17:39:58 +02:00
bb279bb212 UUID does not have spaceship operator
Some checks failed
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Failing after 5m22s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Failing after 5m21s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Failing after 5m44s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (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: 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_asan (Unity Build: ON) (push) Has been cancelled
2026-05-16 17:19:01 +02:00
21 changed files with 229 additions and 85 deletions

View File

@@ -227,12 +227,11 @@ void Iterate(benchmark::State& state)
state.SetItemsProcessed(state.iterations() * count); state.SetItemsProcessed(state.iterations() * count);
} }
// Register all four benchmarks for one container adapter under a readable name.
#define BIGFOOT_REGISTER_BENCHMARKS(ADAPTOR, NAME) \ #define BIGFOOT_REGISTER_BENCHMARKS(ADAPTOR, NAME) \
BENCHMARK_TEMPLATE(Insert, ADAPTOR)->Name(NAME "/Insert")->Range(8, 8 << 20); \ BENCHMARK_TEMPLATE(Insert, ADAPTOR)->Name(NAME "/Insert")->Arg(512)->Arg(8192)->Arg(262'144)->Arg(4'194'304); \
BENCHMARK_TEMPLATE(Remove, ADAPTOR)->Name(NAME "/Remove")->Range(8, 8 << 20); \ BENCHMARK_TEMPLATE(Remove, ADAPTOR)->Name(NAME "/Remove")->Arg(512)->Arg(8192)->Arg(262'144)->Arg(4'194'304); \
BENCHMARK_TEMPLATE(Get, ADAPTOR)->Name(NAME "/Get")->Range(8, 8 << 20); \ BENCHMARK_TEMPLATE(Get, ADAPTOR)->Name(NAME "/Get")->Arg(512)->Arg(8192)->Arg(262'144)->Arg(4'194'304); \
BENCHMARK_TEMPLATE(Iterate, ADAPTOR)->Name(NAME "/Iterate")->Range(8, 8 << 20) BENCHMARK_TEMPLATE(Iterate, ADAPTOR)->Name(NAME "/Iterate")->Arg(512)->Arg(8192)->Arg(262'144)->Arg(4'194'304);
using UnorderedDenseMapHarness = HashMapHarnessAdaptor<ankerl::unordered_dense::map<std::uint64_t, MyComplexStruct>>; using UnorderedDenseMapHarness = HashMapHarnessAdaptor<ankerl::unordered_dense::map<std::uint64_t, MyComplexStruct>>;
using UnorderedDenseSegementedMapHarness = using UnorderedDenseSegementedMapHarness =
@@ -247,4 +246,5 @@ BIGFOOT_REGISTER_BENCHMARKS(UnorderedMapHarness, "std::unordered_map");
BIGFOOT_REGISTER_BENCHMARKS(MapHarness, "std::map"); BIGFOOT_REGISTER_BENCHMARKS(MapHarness, "std::map");
#undef BIGFOOT_REGISTER_BENCHMARKS #undef BIGFOOT_REGISTER_BENCHMARKS
#undef BIGFOOT_CACHE_TIER_ARGS
} // namespace Bigfoot } // namespace Bigfoot

View File

@@ -29,9 +29,7 @@ class Asset
.name = eastl::string {}, .name = eastl::string {},
.type_id = GetTypeID(), .type_id = GetTypeID(),
.type_name = eastl::string {GetTypeName()}, .type_name = eastl::string {GetTypeName()},
.version = 0}), .version = 0})
m_hardRefCount(0),
m_softRefCount(0)
{ {
} }
@@ -127,9 +125,6 @@ class Asset
private: private:
::Flat::Bigfoot::AssetHeaderT m_header; ::Flat::Bigfoot::AssetHeaderT m_header;
typename FLAT_ASSET::NativeTableType m_asset; typename FLAT_ASSET::NativeTableType m_asset;
std::uint32_t m_hardRefCount;
std::uint32_t m_softRefCount;
}; };
} // namespace Bigfoot } // namespace Bigfoot

View File

@@ -34,17 +34,33 @@ class UUID
UUID(const UUID& p_uuid) = default; UUID(const UUID& p_uuid) = default;
UUID(UUID&& p_uuid) noexcept = default; UUID(UUID&& p_uuid) noexcept = default;
/**
* Gets the raw bytes of a UUID
*
* \return A view to the raw bytes
*/
[[nodiscard]]
std::span<const std::byte, UUID_BYTE_SIZE> ToBytes() const;
/**
* Gets the string representation of a UUID
*
* \return A string representing the UUID
*/
[[nodiscard]]
std::string ToString() const;
~UUID() = default; ~UUID() = default;
operator std::span<const std::byte, UUID_BYTE_SIZE>() const;
operator std::string() const;
operator bool() const; operator bool() const;
UUID& operator=(const UUID& p_uuid) = default; UUID& operator=(const UUID& p_uuid) = default;
UUID& operator=(UUID&& p_uuid) noexcept = default; UUID& operator=(UUID&& p_uuid) noexcept = default;
[[nodiscard]] [[nodiscard]]
auto operator<=>(const UUID& p_uuid) const = default; bool operator==(const UUID& p_uuid) const;
[[nodiscard]]
bool operator<(const UUID& p_uuid) const;
private: private:
/** /**
@@ -109,7 +125,7 @@ struct std::formatter<Bigfoot::UUID, char>
template<typename FormatContext> template<typename FormatContext>
auto format(const Bigfoot::UUID& p_uuid, FormatContext& ctx) const auto format(const Bigfoot::UUID& p_uuid, FormatContext& ctx) const
{ {
return std::format_to(ctx.out(), "{}", static_cast<std::string>(p_uuid)); return std::format_to(ctx.out(), "{}", p_uuid.ToString());
} }
}; };
@@ -128,7 +144,7 @@ struct fmtquill::formatter<Bigfoot::UUID>
auto format(const Bigfoot::UUID& p_uuid, format_context& ctx) const auto format(const Bigfoot::UUID& p_uuid, format_context& ctx) const
{ {
return fmtquill::format_to(ctx.out(), "{}", static_cast<std::string>(p_uuid)); return fmtquill::format_to(ctx.out(), "{}", p_uuid.ToString());
} }
}; };

View File

@@ -43,14 +43,14 @@ UUID::UUID(const std::span<const std::byte, UUID_BYTE_SIZE> p_raw)
/****************************************************************************************/ /****************************************************************************************/
UUID::operator std::span<const std::byte, UUID::UUID_BYTE_SIZE>() const std::span<const std::byte, UUID::UUID_BYTE_SIZE> UUID::ToBytes() const
{ {
return m_uuid.as_bytes(); return m_uuid.as_bytes();
} }
/****************************************************************************************/ /****************************************************************************************/
UUID::operator std::string() const std::string UUID::ToString() const
{ {
return uuids::to_string(m_uuid); return uuids::to_string(m_uuid);
} }
@@ -62,6 +62,18 @@ UUID::operator bool() const
return *this != NULL_UUID; return *this != NULL_UUID;
} }
bool UUID::operator==(const UUID& p_uuid) const
{
return m_uuid == p_uuid.m_uuid;
}
/****************************************************************************************/
bool UUID::operator<(const UUID& p_uuid) const
{
return m_uuid < p_uuid.m_uuid;
}
/****************************************************************************************/ /****************************************************************************************/
std::mt19937 UUID::GetRandomGenerator() std::mt19937 UUID::GetRandomGenerator()
@@ -87,7 +99,7 @@ namespace flatbuffers
{ {
Flat::Bigfoot::UUID Pack(const Bigfoot::UUID& p_uuid) Flat::Bigfoot::UUID Pack(const Bigfoot::UUID& p_uuid)
{ {
const std::span<const std::byte, Bigfoot::UUID::UUID_BYTE_SIZE> bytes = p_uuid; const std::span<const std::byte, Bigfoot::UUID::UUID_BYTE_SIZE> bytes = p_uuid.ToBytes();
return Flat::Bigfoot::UUID { return Flat::Bigfoot::UUID {
std::span<const std::uint8_t, Bigfoot::UUID::UUID_BYTE_SIZE> {reinterpret_cast<const std::uint8_t*>(bytes.data()), std::span<const std::uint8_t, Bigfoot::UUID::UUID_BYTE_SIZE> {reinterpret_cast<const std::uint8_t*>(bytes.data()),
bytes.size()}}; bytes.size()}};

View File

@@ -62,7 +62,7 @@
HANDLER::Handle(location, p_message __VA_OPT__(, ) __VA_ARGS__); \ HANDLER::Handle(location, p_message __VA_OPT__(, ) __VA_ARGS__); \
if (Bigfoot::Singleton<Bigfoot::Log>::HasInstance()) \ if (Bigfoot::Singleton<Bigfoot::Log>::HasInstance()) \
{ \ { \
Bigfoot::Singleton<Bigfoot::Log>::GetInstance().Flush(); \ Bigfoot::Singleton<Bigfoot::Log>::GetInstance().Flush(); \
} \ } \
BREAK; \ BREAK; \
std::abort(); \ std::abort(); \

View File

@@ -145,8 +145,8 @@ class SlotMap
[[nodiscard]] [[nodiscard]]
bool Has(const SlotKey p_slotKey) const bool Has(const SlotKey p_slotKey) const
{ {
return p_slotKey.Valid() && return p_slotKey.Valid() && (p_slotKey.GetIndex() < m_slots.size() &&
(p_slotKey.GetIndex() < m_slots.size() && p_slotKey.GetVersion() == m_slots[p_slotKey.GetIndex()].GetVersion()); p_slotKey.GetVersion() == m_slots[p_slotKey.GetIndex()].GetVersion());
} }
[[nodiscard]] [[nodiscard]]

View File

@@ -49,6 +49,13 @@ class Log
[[nodiscard]] [[nodiscard]]
quill::Logger* RegisterLogger(const LoggerInfo& p_loggerInfo); quill::Logger* RegisterLogger(const LoggerInfo& p_loggerInfo);
/**
* Unregister a logger.
*
* \param p_loggerInfo The logger to unregister
*/
void UnregisterLogger(const LoggerInfo& p_loggerInfo);
/** /**
* Register a logger. * Register a logger.
* *

View File

@@ -13,13 +13,13 @@
#define BIGFOOT_LOG_DEBUG(loggerName, fmt, ...) \ #define BIGFOOT_LOG_DEBUG(loggerName, fmt, ...) \
do \ do \
{ \ { \
if (::quill::Logger* logger = ::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().GetLogger(loggerName)) \ if (::quill::Logger* logger = ::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().GetLogger(loggerName)) \
{ \ { \
QUILL_LOG_DEBUG(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \ QUILL_LOG_DEBUG(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \
} \ } \
else \ else \
{ \ { \
QUILL_LOG_DEBUG(::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().RegisterLogger(loggerName), \ QUILL_LOG_DEBUG(::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().RegisterLogger(loggerName), \
fmt __VA_OPT__(, ) __VA_ARGS__); \ fmt __VA_OPT__(, ) __VA_ARGS__); \
} \ } \
} while (0) } while (0)
@@ -27,13 +27,13 @@
#define BIGFOOT_LOG_TRACE(loggerName, fmt, ...) \ #define BIGFOOT_LOG_TRACE(loggerName, fmt, ...) \
do \ do \
{ \ { \
if (::quill::Logger* logger = ::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().GetLogger(loggerName)) \ if (::quill::Logger* logger = ::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().GetLogger(loggerName)) \
{ \ { \
QUILL_LOG_TRACE_L3(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \ QUILL_LOG_TRACE_L3(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \
} \ } \
else \ else \
{ \ { \
QUILL_LOG_TRACE_L3(::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().RegisterLogger(loggerName), \ QUILL_LOG_TRACE_L3(::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().RegisterLogger(loggerName), \
fmt __VA_OPT__(, ) __VA_ARGS__); \ fmt __VA_OPT__(, ) __VA_ARGS__); \
} \ } \
} while (0) } while (0)
@@ -41,13 +41,13 @@
#define BIGFOOT_LOG_INFO(loggerName, fmt, ...) \ #define BIGFOOT_LOG_INFO(loggerName, fmt, ...) \
do \ do \
{ \ { \
if (::quill::Logger* logger = ::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().GetLogger(loggerName)) \ if (::quill::Logger* logger = ::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().GetLogger(loggerName)) \
{ \ { \
QUILL_LOG_INFO(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \ QUILL_LOG_INFO(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \
} \ } \
else \ else \
{ \ { \
QUILL_LOG_INFO(::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().RegisterLogger(loggerName), \ QUILL_LOG_INFO(::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().RegisterLogger(loggerName), \
fmt __VA_OPT__(, ) __VA_ARGS__); \ fmt __VA_OPT__(, ) __VA_ARGS__); \
} \ } \
} while (0) } while (0)
@@ -55,13 +55,13 @@
#define BIGFOOT_LOG_WARN(loggerName, fmt, ...) \ #define BIGFOOT_LOG_WARN(loggerName, fmt, ...) \
do \ do \
{ \ { \
if (::quill::Logger* logger = ::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().GetLogger(loggerName)) \ if (::quill::Logger* logger = ::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().GetLogger(loggerName)) \
{ \ { \
QUILL_LOG_WARNING(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \ QUILL_LOG_WARNING(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \
} \ } \
else \ else \
{ \ { \
QUILL_LOG_WARNING(::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().RegisterLogger(loggerName), \ QUILL_LOG_WARNING(::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().RegisterLogger(loggerName), \
fmt __VA_OPT__(, ) __VA_ARGS__); \ fmt __VA_OPT__(, ) __VA_ARGS__); \
} \ } \
} while (0) } while (0)
@@ -69,13 +69,13 @@
#define BIGFOOT_LOG_ERROR(loggerName, fmt, ...) \ #define BIGFOOT_LOG_ERROR(loggerName, fmt, ...) \
do \ do \
{ \ { \
if (::quill::Logger* logger = ::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().GetLogger(loggerName)) \ if (::quill::Logger* logger = ::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().GetLogger(loggerName)) \
{ \ { \
QUILL_LOG_ERROR(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \ QUILL_LOG_ERROR(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \
} \ } \
else \ else \
{ \ { \
QUILL_LOG_ERROR(::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().RegisterLogger(loggerName), \ QUILL_LOG_ERROR(::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().RegisterLogger(loggerName), \
fmt __VA_OPT__(, ) __VA_ARGS__); \ fmt __VA_OPT__(, ) __VA_ARGS__); \
} \ } \
} while (0) } while (0)
@@ -83,13 +83,13 @@
#define BIGFOOT_LOG_FATAL(loggerName, fmt, ...) \ #define BIGFOOT_LOG_FATAL(loggerName, fmt, ...) \
do \ do \
{ \ { \
if (::quill::Logger* logger = ::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().GetLogger(loggerName)) \ if (::quill::Logger* logger = ::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().GetLogger(loggerName)) \
{ \ { \
QUILL_LOG_CRITICAL(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \ QUILL_LOG_CRITICAL(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \
} \ } \
else \ else \
{ \ { \
QUILL_LOG_CRITICAL(::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().RegisterLogger(loggerName), \ QUILL_LOG_CRITICAL(::Bigfoot::Singleton<::Bigfoot::Log>::GetInstance().RegisterLogger(loggerName), \
fmt __VA_OPT__(, ) __VA_ARGS__); \ fmt __VA_OPT__(, ) __VA_ARGS__); \
} \ } \
} while (0) } while (0)

View File

@@ -86,13 +86,24 @@ class Version
return static_cast<std::uint8_t>(m_combined & mask); return static_cast<std::uint8_t>(m_combined & mask);
} }
/**
* Gets the raw Version
*
* \return the raw version
*/
[[nodiscard]] [[nodiscard]]
constexpr operator std::uint32_t() const constexpr std::uint32_t Raw() const
{ {
return m_combined; return m_combined;
} }
operator std::string() const; /**
* Gets the string representation of the Version
*
* \return The string
*/
[[nodiscard]]
std::string ToString() const;
constexpr Version& operator=(const Version& p_version) = default; constexpr Version& operator=(const Version& p_version) = default;
constexpr Version& operator=(Version&& p_version) = default; constexpr Version& operator=(Version&& p_version) = default;
@@ -123,7 +134,7 @@ struct std::formatter<Bigfoot::Version>
template<typename FormatContext> template<typename FormatContext>
auto format(const Bigfoot::Version& p_version, FormatContext& p_context) const auto format(const Bigfoot::Version& p_version, FormatContext& p_context) const
{ {
return std::format_to(p_context.out(), "{}", static_cast<std::string>(p_version)); return std::format_to(p_context.out(), "{}", p_version.ToString());
} }
}; };
#endif #endif

View File

@@ -33,6 +33,16 @@ quill::Logger* Log::RegisterLogger(const LoggerInfo& p_loggerInfo)
/****************************************************************************************/ /****************************************************************************************/
void Log::UnregisterLogger(const LoggerInfo& p_loggerInfo)
{
if (quill::Logger* logger = quill::Frontend::get_logger(p_loggerInfo.m_name))
{
quill::Frontend::remove_logger_blocking(logger);
}
}
/****************************************************************************************/
quill::Logger* Log::GetLogger(const LoggerInfo& p_loggerInfo) quill::Logger* Log::GetLogger(const LoggerInfo& p_loggerInfo)
{ {
return quill::Frontend::get_logger(p_loggerInfo.m_name); return quill::Frontend::get_logger(p_loggerInfo.m_name);
@@ -92,12 +102,10 @@ void Log::Flush()
Log::~Log() Log::~Log()
{ {
Flush(); Flush();
for (quill::Logger* logger: quill::Frontend::get_all_loggers()) for (quill::Logger* logger: quill::Frontend::get_all_loggers())
{ {
quill::Frontend::remove_logger(logger); quill::Frontend::remove_logger_blocking(logger);
} }
quill::Backend::stop(); quill::Backend::stop();
} }
} // namespace Bigfoot } // namespace Bigfoot

View File

@@ -8,7 +8,7 @@
namespace Bigfoot namespace Bigfoot
{ {
Version::operator std::string() const std::string Version::ToString() const
{ {
return std::format("{}.{}.{}", GetMajor(), GetMinor(), GetPatch()); return std::format("{}.{}.{}", GetMajor(), GetMinor(), GetPatch());
} }

View File

@@ -53,37 +53,37 @@ TEST_F(BigFileFixture, BigFileManipulation)
BigFile::Request assetHeaderRequest { BigFile::Request assetHeaderRequest {
m_bigFile, m_bigFile,
"INSERT INTO AssetHeader (UUID, Name, TypeID, TypeName) VALUES(?, ?, ?, ?)"}; "INSERT INTO AssetHeader (UUID, Name, TypeID, TypeName) VALUES(?, ?, ?, ?)"};
assetHeaderRequest.Bind(1, static_cast<std::span<const std::byte, UUID::UUID_BYTE_SIZE>>(uuid)); assetHeaderRequest.Bind(1, uuid.ToBytes());
assetHeaderRequest.Bind(2, "Test"); assetHeaderRequest.Bind(2, "Test");
assetHeaderRequest.Bind(3, typeIDRef); assetHeaderRequest.Bind(3, typeIDRef);
assetHeaderRequest.Bind(4, "TypeTest"); assetHeaderRequest.Bind(4, "TypeTest");
BigFile::Request assetRequest {m_bigFile, "INSERT INTO Asset (UUID, Asset) VALUES(?, ?)"}; BigFile::Request assetRequest {m_bigFile, "INSERT INTO Asset (UUID, Asset) VALUES(?, ?)"};
assetRequest.Bind(1, static_cast<std::span<const std::byte, UUID::UUID_BYTE_SIZE>>(uuid)); assetRequest.Bind(1, uuid.ToBytes());
assetRequest.Bind(2, blob); assetRequest.Bind(2, blob);
BigFile::Request assetHeaderRequest2 { BigFile::Request assetHeaderRequest2 {
m_bigFile, m_bigFile,
"INSERT INTO AssetHeader (UUID, Name, TypeID, TypeName) VALUES(?, ?, ?, ?)"}; "INSERT INTO AssetHeader (UUID, Name, TypeID, TypeName) VALUES(?, ?, ?, ?)"};
assetHeaderRequest2.Bind(1, static_cast<std::span<const std::byte, UUID::UUID_BYTE_SIZE>>(uuid2)); assetHeaderRequest2.Bind(1, uuid2.ToBytes());
assetHeaderRequest2.Bind(2, "Test2"); assetHeaderRequest2.Bind(2, "Test2");
assetHeaderRequest2.Bind(3, typeIDRef); assetHeaderRequest2.Bind(3, typeIDRef);
assetHeaderRequest2.Bind(4, "TypeTest"); assetHeaderRequest2.Bind(4, "TypeTest");
BigFile::Request assetRequest2 {m_bigFile, "INSERT INTO Asset (UUID, Asset) VALUES(?, ?)"}; BigFile::Request assetRequest2 {m_bigFile, "INSERT INTO Asset (UUID, Asset) VALUES(?, ?)"};
assetRequest2.Bind(1, static_cast<std::span<const std::byte, UUID::UUID_BYTE_SIZE>>(uuid2)); assetRequest2.Bind(1, uuid2.ToBytes());
assetRequest2.Bind(2, blob3); assetRequest2.Bind(2, blob3);
BigFile::Request assetHeaderRequest3 { BigFile::Request assetHeaderRequest3 {
m_bigFile, m_bigFile,
"INSERT INTO AssetHeader (UUID, Name, TypeID, TypeName) VALUES(?, ?, ?, ?)"}; "INSERT INTO AssetHeader (UUID, Name, TypeID, TypeName) VALUES(?, ?, ?, ?)"};
assetHeaderRequest3.Bind(1, static_cast<std::span<const std::byte, UUID::UUID_BYTE_SIZE>>(uuid3)); assetHeaderRequest3.Bind(1, uuid3.ToBytes());
assetHeaderRequest3.Bind(2, "Test3"); assetHeaderRequest3.Bind(2, "Test3");
assetHeaderRequest3.Bind(3, typeIDRef); assetHeaderRequest3.Bind(3, typeIDRef);
assetHeaderRequest3.Bind(4, "TypeTest"); assetHeaderRequest3.Bind(4, "TypeTest");
BigFile::Request assetRequest3 {m_bigFile, "INSERT INTO Asset (UUID, Asset) VALUES(?, ?)"}; BigFile::Request assetRequest3 {m_bigFile, "INSERT INTO Asset (UUID, Asset) VALUES(?, ?)"};
assetRequest3.Bind(1, static_cast<std::span<const std::byte, UUID::UUID_BYTE_SIZE>>(uuid3)); assetRequest3.Bind(1, uuid3.ToBytes());
assetRequest3.Bind(2, blob4); assetRequest3.Bind(2, blob4);
m_bigFile.BeginTransaction(); m_bigFile.BeginTransaction();
@@ -108,7 +108,7 @@ TEST_F(BigFileFixture, BigFileManipulation)
{ {
BigFile::Request updateAsset {m_bigFile, "UPDATE Asset SET Asset = ? WHERE UUID = ?"}; BigFile::Request updateAsset {m_bigFile, "UPDATE Asset SET Asset = ? WHERE UUID = ?"};
updateAsset.Bind(1, blob2); updateAsset.Bind(1, blob2);
updateAsset.Bind(2, static_cast<std::span<const std::byte, UUID::UUID_BYTE_SIZE>>(uuid)); updateAsset.Bind(2, uuid.ToBytes());
m_bigFile.BeginTransaction(); m_bigFile.BeginTransaction();
std::uint32_t updateAssetChangedCount = updateAsset.Execute(); std::uint32_t updateAssetChangedCount = updateAsset.Execute();
@@ -120,7 +120,7 @@ TEST_F(BigFileFixture, BigFileManipulation)
BigFile::Request request { BigFile::Request request {
m_bigFile, m_bigFile,
"SELECT Name, TypeID, TypeName, CreateTime, ModificationTime FROM AssetHeader WHERE UUID = ?"}; "SELECT Name, TypeID, TypeName, CreateTime, ModificationTime FROM AssetHeader WHERE UUID = ?"};
request.Bind(1, static_cast<std::span<const std::byte, UUID::UUID_BYTE_SIZE>>(uuid)); request.Bind(1, uuid.ToBytes());
const bool get = request.Step(); const bool get = request.Step();
EXPECT_TRUE(get); EXPECT_TRUE(get);

View File

@@ -0,0 +1,19 @@
/*********************************************************************
* \file main.cpp
*
* \author Romain BOULLARD
* \date May 2026
*********************************************************************/
#include <Utils/Log/LogMacros.hpp>
#include <Utils/TargetMacros.h>
#include <gtest/gtest.h>
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
BIGFOOT_NOT_OPTIMIZED_ONLY(::Bigfoot::Singleton<::Bigfoot::Log>::Lifetime m_lifetime);
return RUN_ALL_TESTS();
}

View File

@@ -0,0 +1,19 @@
/*********************************************************************
* \file main.cpp
*
* \author Romain BOULLARD
* \date May 2026
*********************************************************************/
#include <Utils/Log/LogMacros.hpp>
#include <Utils/TargetMacros.h>
#include <gtest/gtest.h>
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
BIGFOOT_NOT_OPTIMIZED_ONLY(::Bigfoot::Singleton<::Bigfoot::Log>::Lifetime m_lifetime);
return RUN_ALL_TESTS();
}

View File

@@ -43,13 +43,13 @@ class UUIDFixture: public ::testing::Test
TEST_F(UUIDFixture, DumpingRawAndConstructAnUUIDWithItShouldGiveTheSameUUID) TEST_F(UUIDFixture, DumpingRawAndConstructAnUUIDWithItShouldGiveTheSameUUID)
{ {
std::span<const std::byte, UUID::UUID_BYTE_SIZE> raw = m_a; std::span<const std::byte, UUID::UUID_BYTE_SIZE> raw = m_a.ToBytes();
EXPECT_EQ(m_a, UUID {raw}); EXPECT_EQ(m_a, UUID {raw});
raw = m_b; raw = m_b.ToBytes();
EXPECT_EQ(m_b, UUID {raw}); EXPECT_EQ(m_b, UUID {raw});
raw = m_d; raw = m_d.ToBytes();
EXPECT_EQ(m_d, UUID {raw}); EXPECT_EQ(m_d, UUID {raw});
} }
@@ -57,21 +57,21 @@ TEST_F(UUIDFixture, DumpingRawAndConstructAnUUIDWithItShouldGiveTheSameUUID)
TEST_F(UUIDFixture, ValidIDFromStringShouldBeEqualToString) TEST_F(UUIDFixture, ValidIDFromStringShouldBeEqualToString)
{ {
EXPECT_EQ(static_cast<std::string>(m_b), "47183823-2574-4bfd-b411-99ed177d3e43"); EXPECT_EQ(m_b.ToString(), "47183823-2574-4bfd-b411-99ed177d3e43");
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(UUIDFixture, InvalidIDFromStringShouldNotBeEqualToString) TEST_F(UUIDFixture, InvalidIDFromStringShouldNotBeEqualToString)
{ {
EXPECT_NE(static_cast<std::string>(m_c), "4bfd-b411-99ed177d3e43"); EXPECT_NE(m_c.ToString(), "4bfd-b411-99ed177d3e43");
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(UUIDFixture, NullIDStringShouldBeEqualToNullIDString) TEST_F(UUIDFixture, NullIDStringShouldBeEqualToNullIDString)
{ {
EXPECT_EQ(static_cast<std::string>(UUID::NULL_UUID), "00000000-0000-0000-0000-000000000000"); EXPECT_EQ(UUID::NULL_UUID.ToString(), "00000000-0000-0000-0000-000000000000");
} }
/****************************************************************************************/ /****************************************************************************************/
@@ -168,9 +168,9 @@ TEST_F(UUIDFixture, GeneratingFiveMillionUniqueID)
/****************************************************************************************/ /****************************************************************************************/
TEST_F(UUIDFixture, Raw_ShouldGiveBackTheRawDataOfTheID) TEST_F(UUIDFixture, ToBytes_ShouldGiveBackTheRawDataOfTheID)
{ {
std::span<const std::byte, UUID::UUID_BYTE_SIZE> d = m_d; std::span<const std::byte, UUID::UUID_BYTE_SIZE> d = m_d.ToBytes();
std::span<const std::byte, UUID::UUID_BYTE_SIZE> raw = m_raw; std::span<const std::byte, UUID::UUID_BYTE_SIZE> raw = m_raw;
for (std::uint32_t i = 0; i < UUID::UUID_BYTE_SIZE; ++i) for (std::uint32_t i = 0; i < UUID::UUID_BYTE_SIZE; ++i)

View File

@@ -3,3 +3,5 @@ project(${PackageName}Tests)
bigfoot_create_package_tests( bigfoot_create_package_tests(
"") "")
bigfoot_create_logger()

View File

@@ -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/LogMacros.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED
namespace Bigfoot
{
/*
* Logger
*/
inline Log::LoggerInfo UTILSTESTS_LOGGER {"UTILSTESTS_LOGGER", Flat::LogLevel::Trace};
} // namespace Bigfoot
#endif
#endif

View File

@@ -6,6 +6,10 @@
*********************************************************************/ *********************************************************************/
#include <Utils/Log/Log.hpp> #include <Utils/Log/Log.hpp>
#include <Utils/Singleton.hpp>
#include <UtilsTests/UtilsTestsLogger_generated.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED #if defined BIGFOOT_NOT_OPTIMIZED
#include <gtest/gtest.h> #include <gtest/gtest.h>
@@ -37,46 +41,57 @@ class LogFixture: public ::testing::Test
return Flat::LogLevel::Trace; return Flat::LogLevel::Trace;
} }
Log m_log;
Log::LoggerInfo m_logger {"LOGGER", Flat::LogLevel::Trace};
}; };
/****************************************************************************************/ /****************************************************************************************/
TEST_F(LogFixture, RegisterLogger_ShouldRegisterTheLogger) TEST_F(LogFixture, RegisterLogger_ShouldRegisterTheLogger)
{ {
const quill::Logger* logger = m_log.RegisterLogger(m_logger); const quill::Logger* logger = Singleton<Log>::GetInstance().RegisterLogger(UTILSTESTS_LOGGER);
EXPECT_TRUE(logger); EXPECT_TRUE(logger);
EXPECT_EQ(logger, m_log.GetLogger(m_logger)); EXPECT_EQ(logger, Singleton<Log>::GetInstance().GetLogger(UTILSTESTS_LOGGER));
EXPECT_EQ(logger->get_logger_name(), m_logger.m_name); EXPECT_EQ(logger->get_logger_name(), UTILSTESTS_LOGGER.m_name);
EXPECT_EQ(QuillLogLevelToLogLevel(logger->get_log_level()), m_logger.m_level); EXPECT_EQ(QuillLogLevelToLogLevel(logger->get_log_level()), UTILSTESTS_LOGGER.m_level);
}
/****************************************************************************************/
TEST_F(LogFixture, UnregisterLogger_ShouldUnregisterTheLogger)
{
std::ignore = Singleton<Log>::GetInstance().RegisterLogger(UTILSTESTS_LOGGER);
Singleton<Log>::GetInstance().UnregisterLogger(UTILSTESTS_LOGGER);
EXPECT_EQ(Singleton<Log>::GetInstance().GetLogger(UTILSTESTS_LOGGER), nullptr);
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(LogFixture, GetLogger_ShouldReturnNullptrIfTheLoggerDoesNotExist) TEST_F(LogFixture, GetLogger_ShouldReturnNullptrIfTheLoggerDoesNotExist)
{ {
EXPECT_FALSE(m_log.GetLogger(m_logger)); EXPECT_FALSE(Singleton<Log>::GetInstance().GetLogger(UTILSTESTS_LOGGER));
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(LogFixture, GetLogger_ShouldReturnTheLoggerIfItExists) TEST_F(LogFixture, GetLoger_ShouldReturnTheLoggerIfItExists)
{ {
[[maybe_unused]] [[maybe_unused]]
const quill::Logger* logger = m_log.RegisterLogger(m_logger); const quill::Logger* logger = Singleton<Log>::GetInstance().RegisterLogger(UTILSTESTS_LOGGER);
EXPECT_TRUE(m_log.GetLogger(m_logger)); EXPECT_TRUE(Singleton<Log>::GetInstance().GetLogger(UTILSTESTS_LOGGER));
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(LogFixture, ChangeLoggerLogLevel_ShouldChangeTheLoggerLogLevel) TEST_F(LogFixture, ChangeLoggerLogLevel_ShouldChangeTheLoggerLogLevel)
{ {
const quill::Logger* logger = m_log.RegisterLogger(m_logger); const Flat::LogLevel previous = UTILSTESTS_LOGGER.m_level;
m_log.ChangeLoggerLogLevel(m_logger, Flat::LogLevel::Critical); const quill::Logger* logger = Singleton<Log>::GetInstance().RegisterLogger(UTILSTESTS_LOGGER);
Singleton<Log>::GetInstance().ChangeLoggerLogLevel(UTILSTESTS_LOGGER, Flat::LogLevel::Critical);
EXPECT_EQ(QuillLogLevelToLogLevel(logger->get_log_level()), Flat::LogLevel::Critical); EXPECT_EQ(QuillLogLevelToLogLevel(logger->get_log_level()), Flat::LogLevel::Critical);
Singleton<Log>::GetInstance().ChangeLoggerLogLevel(UTILSTESTS_LOGGER, previous);
EXPECT_EQ(QuillLogLevelToLogLevel(logger->get_log_level()), previous);
} }
} // namespace Bigfoot } // namespace Bigfoot
#endif #endif

View File

@@ -6,6 +6,8 @@
*********************************************************************/ *********************************************************************/
#include <Utils/Log/LogMacros.hpp> #include <Utils/Log/LogMacros.hpp>
#include <UtilsTests/UtilsTestsLogger_generated.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED #if defined BIGFOOT_NOT_OPTIMIZED
#include <gtest/gtest.h> #include <gtest/gtest.h>
@@ -15,50 +17,48 @@ namespace Bigfoot
class LogMacrosFixture: public ::testing::Test class LogMacrosFixture: public ::testing::Test
{ {
protected: protected:
Singleton<Log>::Lifetime m_singletonLifetime;
Log::LoggerInfo m_logger {"LOGGER", Flat::LogLevel::Trace};
}; };
/****************************************************************************************/ /****************************************************************************************/
TEST_F(LogMacrosFixture, LogDebug) TEST_F(LogMacrosFixture, LogDebug)
{ {
BIGFOOT_LOG_DEBUG(m_logger, "Hello"); BIGFOOT_LOG_DEBUG(UTILSTESTS_LOGGER, "Hello");
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(LogMacrosFixture, LogTrace) TEST_F(LogMacrosFixture, LogTrace)
{ {
BIGFOOT_LOG_TRACE(m_logger, "Hello"); BIGFOOT_LOG_TRACE(UTILSTESTS_LOGGER, "Hello");
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(LogMacrosFixture, LogInfo) TEST_F(LogMacrosFixture, LogInfo)
{ {
BIGFOOT_LOG_INFO(m_logger, "Hello"); BIGFOOT_LOG_INFO(UTILSTESTS_LOGGER, "Hello");
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(LogMacrosFixture, LogWarn) TEST_F(LogMacrosFixture, LogWarn)
{ {
BIGFOOT_LOG_WARN(m_logger, "Hello"); BIGFOOT_LOG_WARN(UTILSTESTS_LOGGER, "Hello");
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(LogMacrosFixture, LogError) TEST_F(LogMacrosFixture, LogError)
{ {
BIGFOOT_LOG_ERROR(m_logger, "Hello"); BIGFOOT_LOG_ERROR(UTILSTESTS_LOGGER, "Hello");
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(LogMacrosFixture, LogFatal) TEST_F(LogMacrosFixture, LogFatal)
{ {
BIGFOOT_LOG_FATAL(m_logger, "Hello"); BIGFOOT_LOG_FATAL(UTILSTESTS_LOGGER, "Hello");
} }
} // namespace Bigfoot } // namespace Bigfoot
#endif #endif

View File

@@ -0,0 +1,19 @@
/*********************************************************************
* \file main.cpp
*
* \author Romain BOULLARD
* \date May 2026
*********************************************************************/
#include <Utils/Log/LogMacros.hpp>
#include <Utils/TargetMacros.h>
#include <gtest/gtest.h>
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
BIGFOOT_NOT_OPTIMIZED_ONLY(::Bigfoot::Singleton<::Bigfoot::Log>::Lifetime m_lifetime);
return RUN_ALL_TESTS();
}

View File

@@ -19,18 +19,18 @@ class VersionFixture: public ::testing::Test
/****************************************************************************************/ /****************************************************************************************/
TEST_F(VersionFixture, string) TEST_F(VersionFixture, ToString)
{ {
EXPECT_STREQ(static_cast<std::string>(m_detailed).data(), "1.2.3"); EXPECT_STREQ(m_detailed.ToString().data(), "1.2.3");
EXPECT_STREQ(static_cast<std::string>(m_combined).data(), "1.2.3"); EXPECT_STREQ(m_combined.ToString().data(), "1.2.3");
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(VersionFixture, uint32_t) TEST_F(VersionFixture, Raw)
{ {
EXPECT_EQ(static_cast<std::uint32_t>(m_detailed), (1 << 16) | (2 << 8) | 3); EXPECT_EQ(m_detailed.Raw(), (1 << 16) | (2 << 8) | 3);
EXPECT_EQ(static_cast<std::uint32_t>(m_combined), (1 << 16) | (2 << 8) | 3); EXPECT_EQ(m_combined.Raw(), (1 << 16) | (2 << 8) | 3);
} }
/****************************************************************************************/ /****************************************************************************************/