Maintenance
Some checks failed
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Failing after 5m37s
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_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 Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled

This commit is contained in:
2026-05-16 17:10:17 +02:00
parent 87d59a00c1
commit 00b86fbd00
23 changed files with 174 additions and 213 deletions

View File

@@ -13,11 +13,11 @@ namespace Bigfoot
BigFile::BigFile(const File& p_file) BigFile::BigFile(const File& p_file)
{ {
[[maybe_unused]] [[maybe_unused]]
const int result = sqlite3_open_v2(p_file.Absolute().Path().data(), &m_db, SQLITE_OPEN_READWRITE, nullptr); const int result = sqlite3_open_v2(p_file.ToAbsolute().GetPath().data(), &m_db, SQLITE_OPEN_READWRITE, nullptr);
CRITICAL_ASSERT(EngineAssertHandler, CRITICAL_ASSERT(EngineAssertHandler,
result == SQLITE_OK, result == SQLITE_OK,
"Failed to open BigFile {} DB: {}", "Failed to open BigFile {} DB: {}",
p_file.Absolute().Path(), p_file.ToAbsolute().GetPath(),
sqlite3_errmsg(m_db)); sqlite3_errmsg(m_db));
} }

View File

@@ -27,8 +27,8 @@ class Asset
Asset(): Asset():
m_header(::Flat::Bigfoot::AssetHeaderT {.uuid = UUID {}, m_header(::Flat::Bigfoot::AssetHeaderT {.uuid = UUID {},
.name = eastl::string {}, .name = eastl::string {},
.type_id = TypeID(), .type_id = GetTypeID(),
.type_name = eastl::string {TypeName()}, .type_name = eastl::string {GetTypeName()},
.version = 0}), .version = 0}),
m_hardRefCount(0), m_hardRefCount(0),
m_softRefCount(0) m_softRefCount(0)
@@ -62,7 +62,7 @@ class Asset
~Asset() = default; ~Asset() = default;
[[nodiscard]] [[nodiscard]]
const ::Flat::Bigfoot::AssetHeaderT& Header() const const ::Flat::Bigfoot::AssetHeaderT& GetHeader() const
{ {
return m_header; return m_header;
} }
@@ -108,7 +108,7 @@ class Asset
} }
[[nodiscard]] [[nodiscard]]
static std::uint64_t TypeID() static std::uint64_t GetTypeID()
{ {
static const std::uint64_t typeID = rapidhash(FLAT_ASSET::GetFullyQualifiedName(), static const std::uint64_t typeID = rapidhash(FLAT_ASSET::GetFullyQualifiedName(),
std::strlen(FLAT_ASSET::GetFullyQualifiedName())); std::strlen(FLAT_ASSET::GetFullyQualifiedName()));
@@ -116,7 +116,7 @@ class Asset
} }
[[nodiscard]] [[nodiscard]]
static eastl::string_view TypeName() static eastl::string_view GetTypeName()
{ {
return FLAT_ASSET::GetFullyQualifiedName(); return FLAT_ASSET::GetFullyQualifiedName();
} }

View File

@@ -33,7 +33,7 @@ class AssetContainer
typename SlotMap<ASSET>::SlotKey Insert(ARGS&&... p_args) typename SlotMap<ASSET>::SlotKey Insert(ARGS&&... p_args)
{ {
const typename SlotMap<ASSET>::SlotKey slotKey = m_assets.Insert(std::forward<ARGS>(p_args)...); const typename SlotMap<ASSET>::SlotKey slotKey = m_assets.Insert(std::forward<ARGS>(p_args)...);
m_uuidToSlotKey.insert({m_assets.Get(slotKey)->Header().uuid, slotKey}); m_uuidToSlotKey.insert({m_assets.Get(slotKey)->GetHeader().uuid, slotKey});
return slotKey; return slotKey;
} }
@@ -51,7 +51,7 @@ class AssetContainer
} }
[[nodiscard]] [[nodiscard]]
typename SlotMap<ASSET>::SlotKey SlotKey(const UUID& p_uuid) const typename SlotMap<ASSET>::SlotKey GetSlotKey(const UUID& p_uuid) const
{ {
if (const auto it = m_uuidToSlotKey.find(p_uuid); it != m_uuidToSlotKey.end()) if (const auto it = m_uuidToSlotKey.find(p_uuid); it != m_uuidToSlotKey.end())
{ {
@@ -76,7 +76,7 @@ class AssetContainer
{ {
if (const ASSET* asset = Get(p_key)) if (const ASSET* asset = Get(p_key))
{ {
const UUID uuid = asset->Header().uuid; const UUID uuid = asset->GetHeader().uuid;
m_assets.Remove(p_key); m_assets.Remove(p_key);
m_uuidToSlotKey.erase(uuid); m_uuidToSlotKey.erase(uuid);
} }

View File

@@ -37,21 +37,21 @@ bool File::Exists() const
/****************************************************************************************/ /****************************************************************************************/
eastl::string_view File::Path() const eastl::string_view File::GetPath() const
{ {
return m_pathString; return m_pathString;
} }
/****************************************************************************************/ /****************************************************************************************/
File File::Absolute() const File File::ToAbsolute() const
{ {
return File {std::filesystem::absolute(m_path)}; return File {std::filesystem::absolute(m_path)};
} }
/****************************************************************************************/ /****************************************************************************************/
File File::Relative() const File File::ToRelative() const
{ {
return File {std::filesystem::relative(m_path)}; return File {std::filesystem::relative(m_path)};
} }

View File

@@ -57,7 +57,7 @@ class File
* \return The path * \return The path
*/ */
[[nodiscard]] [[nodiscard]]
eastl::string_view Path() const; eastl::string_view GetPath() const;
/** /**
* Get the same file, relative to the current executable * Get the same file, relative to the current executable
@@ -65,7 +65,7 @@ class File
* \return The relative file * \return The relative file
*/ */
[[nodiscard]] [[nodiscard]]
File Relative() const; File ToRelative() const;
/** /**
* Get the same file, with an absolute path * Get the same file, with an absolute path
@@ -73,7 +73,7 @@ class File
* \return The absolute file * \return The absolute file
*/ */
[[nodiscard]] [[nodiscard]]
File Absolute() const; File ToAbsolute() const;
~File() = default; ~File() = default;

View File

@@ -21,28 +21,28 @@ class Time
Time(Time&& p_time) = default; Time(Time&& p_time) = default;
[[nodiscard]] [[nodiscard]]
std::uint32_t Year() const; std::uint32_t GetYear() const;
[[nodiscard]] [[nodiscard]]
std::uint32_t Month() const; std::uint32_t GetMonth() const;
[[nodiscard]] [[nodiscard]]
std::uint32_t Day() const; std::uint32_t GetDay() const;
[[nodiscard]] [[nodiscard]]
std::uint32_t Hour() const; std::uint32_t GetHour() const;
[[nodiscard]] [[nodiscard]]
std::uint32_t Minute() const; std::uint32_t GetMinute() const;
[[nodiscard]] [[nodiscard]]
std::uint32_t Second() const; std::uint32_t GetSecond() const;
[[nodiscard]] [[nodiscard]]
std::uint32_t Microsecond() const; std::uint32_t GetMicrosecond() const;
[[nodiscard]] [[nodiscard]]
std::uint64_t Epoch() const; std::uint64_t GetEpoch() const;
~Time() = default; ~Time() = default;

View File

@@ -44,11 +44,7 @@ class UUID
UUID& operator=(UUID&& p_uuid) noexcept = default; UUID& operator=(UUID&& p_uuid) noexcept = default;
[[nodiscard]] [[nodiscard]]
bool operator==(const UUID& p_uuid) const = default; auto operator<=>(const UUID& p_uuid) const = default;
[[nodiscard]]
bool operator!=(const UUID& p_uuid) const = default;
[[nodiscard]]
bool operator<(const UUID& p_uuid) const;
private: private:
/** /**

View File

@@ -55,56 +55,56 @@ Time::Time(const std::uint64_t p_epoch):
/****************************************************************************************/ /****************************************************************************************/
std::uint32_t Time::Year() const std::uint32_t Time::GetYear() const
{ {
return m_timeInfo.tm_year + 1900; return m_timeInfo.tm_year + 1900;
} }
/****************************************************************************************/ /****************************************************************************************/
std::uint32_t Time::Month() const std::uint32_t Time::GetMonth() const
{ {
return m_timeInfo.tm_mon + 1; return m_timeInfo.tm_mon + 1;
} }
/****************************************************************************************/ /****************************************************************************************/
std::uint32_t Time::Day() const std::uint32_t Time::GetDay() const
{ {
return m_timeInfo.tm_mday; return m_timeInfo.tm_mday;
} }
/****************************************************************************************/ /****************************************************************************************/
std::uint32_t Time::Hour() const std::uint32_t Time::GetHour() const
{ {
return m_timeInfo.tm_hour; return m_timeInfo.tm_hour;
} }
/****************************************************************************************/ /****************************************************************************************/
std::uint32_t Time::Minute() const std::uint32_t Time::GetMinute() const
{ {
return m_timeInfo.tm_min; return m_timeInfo.tm_min;
} }
/****************************************************************************************/ /****************************************************************************************/
std::uint32_t Time::Second() const std::uint32_t Time::GetSecond() const
{ {
return m_timeInfo.tm_sec; return m_timeInfo.tm_sec;
} }
/****************************************************************************************/ /****************************************************************************************/
std::uint32_t Time::Microsecond() const std::uint32_t Time::GetMicrosecond() const
{ {
return static_cast<std::uint32_t>(m_microseconds.count()); return static_cast<std::uint32_t>(m_microseconds.count());
} }
/****************************************************************************************/ /****************************************************************************************/
std::uint64_t Time::Epoch() const std::uint64_t Time::GetEpoch() const
{ {
return m_epoch; return m_epoch;
} }
@@ -127,7 +127,7 @@ namespace flatbuffers
{ {
Flat::Bigfoot::Time Pack(const Bigfoot::Time& p_time) Flat::Bigfoot::Time Pack(const Bigfoot::Time& p_time)
{ {
return Flat::Bigfoot::Time {p_time.Epoch()}; return Flat::Bigfoot::Time {p_time.GetEpoch()};
} }
/****************************************************************************************/ /****************************************************************************************/

View File

@@ -64,13 +64,6 @@ UUID::operator bool() const
/****************************************************************************************/ /****************************************************************************************/
bool UUID::operator<(const UUID& p_uuid) const
{
return m_uuid < p_uuid.m_uuid;
}
/****************************************************************************************/
std::mt19937 UUID::GetRandomGenerator() std::mt19937 UUID::GetRandomGenerator()
{ {
std::random_device randomDevice; std::random_device randomDevice;

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>::Instance().Flush(); \ Bigfoot::Singleton<Bigfoot::Log>::GetInstance().Flush(); \
} \ } \
BREAK; \ BREAK; \
std::abort(); \ std::abort(); \

View File

@@ -61,15 +61,15 @@ class SlotMap
constexpr bool Valid() const constexpr bool Valid() const
{ {
return Version() != INVALID_VERSION; return GetVersion() != INVALID_VERSION;
} }
constexpr VersionType Version() const constexpr VersionType GetVersion() const
{ {
return static_cast<VersionType>(m_key >> INDEX_BIT_COUNT); return static_cast<VersionType>(m_key >> INDEX_BIT_COUNT);
} }
constexpr IndexType Index() const constexpr IndexType GetIndex() const
{ {
return static_cast<IndexType>(m_key & INDEX_MASK); return static_cast<IndexType>(m_key & INDEX_MASK);
} }
@@ -107,12 +107,12 @@ class SlotMap
{ {
const typename SlotKey::IndexType slotIndex = m_freeSlotHead; const typename SlotKey::IndexType slotIndex = m_freeSlotHead;
m_freeSlotHead = m_slots[slotIndex].Index(); m_freeSlotHead = m_slots[slotIndex].GetIndex();
m_slots[slotIndex] = SlotKey {m_slots[slotIndex].Version(), dataIndex}; m_slots[slotIndex] = SlotKey {m_slots[slotIndex].GetVersion(), dataIndex};
m_dataToSlots.push_back(slotIndex); m_dataToSlots.push_back(slotIndex);
return SlotKey {m_slots[slotIndex].Version(), slotIndex}; return SlotKey {m_slots[slotIndex].GetVersion(), slotIndex};
} }
const typename SlotKey::IndexType slotIndex = static_cast<SlotKey::IndexType>(m_slots.size()); const typename SlotKey::IndexType slotIndex = static_cast<SlotKey::IndexType>(m_slots.size());
@@ -129,36 +129,36 @@ class SlotMap
return; return;
} }
const typename SlotKey::IndexType dataIndex = m_slots[p_slotKey.Index()].Index(); const typename SlotKey::IndexType dataIndex = m_slots[p_slotKey.GetIndex()].GetIndex();
m_data.erase_unsorted(m_data.begin() + dataIndex); m_data.erase_unsorted(m_data.begin() + dataIndex);
m_dataToSlots.erase_unsorted(m_dataToSlots.begin() + dataIndex); m_dataToSlots.erase_unsorted(m_dataToSlots.begin() + dataIndex);
if (dataIndex < m_data.size()) if (dataIndex < m_data.size())
{ {
m_slots[m_dataToSlots[dataIndex]] = SlotKey {m_slots[m_dataToSlots[dataIndex]].Version(), dataIndex}; m_slots[m_dataToSlots[dataIndex]] = SlotKey {m_slots[m_dataToSlots[dataIndex]].GetVersion(), dataIndex};
} }
RecycleSlot(p_slotKey.Version() + 1, p_slotKey.Index()); RecycleSlot(p_slotKey.GetVersion() + 1, p_slotKey.GetIndex());
} }
[[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.Index() < m_slots.size() && p_slotKey.Version() == m_slots[p_slotKey.Index()].Version()); (p_slotKey.GetIndex() < m_slots.size() && p_slotKey.GetVersion() == m_slots[p_slotKey.GetIndex()].GetVersion());
} }
[[nodiscard]] [[nodiscard]]
TYPE* Get(const SlotKey p_slotKey) TYPE* Get(const SlotKey p_slotKey)
{ {
return Has(p_slotKey) ? &m_data[m_slots[p_slotKey.Index()].Index()] : nullptr; return Has(p_slotKey) ? &m_data[m_slots[p_slotKey.GetIndex()].GetIndex()] : nullptr;
} }
[[nodiscard]] [[nodiscard]]
const TYPE* Get(const SlotKey p_slotKey) const const TYPE* Get(const SlotKey p_slotKey) const
{ {
return Has(p_slotKey) ? &m_data[m_slots[p_slotKey.Index()].Index()] : nullptr; return Has(p_slotKey) ? &m_data[m_slots[p_slotKey.GetIndex()].GetIndex()] : nullptr;
} }
void Reset() void Reset()
@@ -173,7 +173,7 @@ class SlotMap
{ {
for (const typename eastl::vector<TYPE>::size_type slotIndex: m_dataToSlots) for (const typename eastl::vector<TYPE>::size_type slotIndex: m_dataToSlots)
{ {
RecycleSlot(m_slots[slotIndex].Version() + 1, static_cast<SlotKey::IndexType>(slotIndex)); RecycleSlot(m_slots[slotIndex].GetVersion() + 1, static_cast<SlotKey::IndexType>(slotIndex));
} }
m_data.clear(); m_data.clear();
@@ -181,13 +181,13 @@ class SlotMap
} }
[[nodiscard]] [[nodiscard]]
eastl::vector<TYPE>::size_type Size() const eastl::vector<TYPE>::size_type GetSize() const
{ {
return m_data.size(); return m_data.size();
} }
[[nodiscard]] [[nodiscard]]
eastl::vector<TYPE>::size_type Capacity() const eastl::vector<TYPE>::size_type GetCapacity() const
{ {
return m_data.capacity(); return m_data.capacity();
} }

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>::Instance().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>::Instance().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>::Instance().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>::Instance().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>::Instance().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>::Instance().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>::Instance().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>::Instance().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>::Instance().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>::Instance().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>::Instance().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>::Instance().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

@@ -26,7 +26,7 @@ class Singleton
* *
* \return The instance * \return The instance
*/ */
static constexpr TYPE& Instance() static constexpr TYPE& GetInstance()
{ {
return ms_instance.value(); return ms_instance.value();
} }

View File

@@ -53,7 +53,7 @@ class Version
* \return The major part of the version. * \return The major part of the version.
*/ */
[[nodiscard]] [[nodiscard]]
constexpr std::uint8_t Major() const constexpr std::uint8_t GetMajor() const
{ {
constexpr std::uint32_t mask = 0b00000000111111110000000000000000; constexpr std::uint32_t mask = 0b00000000111111110000000000000000;
@@ -66,7 +66,7 @@ class Version
* \return The minor part of the version. * \return The minor part of the version.
*/ */
[[nodiscard]] [[nodiscard]]
constexpr std::uint8_t Minor() const constexpr std::uint8_t GetMinor() const
{ {
constexpr std::uint32_t mask = 0b00000000000000001111111100000000; constexpr std::uint32_t mask = 0b00000000000000001111111100000000;
@@ -79,7 +79,7 @@ class Version
* \return The patch part of the version. * \return The patch part of the version.
*/ */
[[nodiscard]] [[nodiscard]]
constexpr std::uint8_t Patch() const constexpr std::uint8_t GetPatch() const
{ {
constexpr std::uint32_t mask = 0b00000000000000000000000011111111; constexpr std::uint32_t mask = 0b00000000000000000000000011111111;
@@ -95,38 +95,10 @@ class Version
operator std::string() const; operator std::string() 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;
[[nodiscard]] [[nodiscard]]
constexpr bool operator>(const Version& p_version) const constexpr auto operator<=>(const Version& p_version) const = default;
{
return m_combined > p_version.m_combined;
}
[[nodiscard]]
constexpr bool operator<(const Version& p_version) const
{
return m_combined < p_version.m_combined;
}
[[nodiscard]]
constexpr bool operator>=(const Version& p_version) const
{
return m_combined >= p_version.m_combined;
}
[[nodiscard]]
constexpr bool operator<=(const Version& p_version) const
{
return m_combined <= p_version.m_combined;
}
[[nodiscard]]
constexpr bool operator==(const Version& p_version) const = default;
[[nodiscard]]
constexpr bool operator!=(const Version& p_version) const = default;
private: private:
/** /**

View File

@@ -10,6 +10,6 @@ namespace Bigfoot
{ {
Version::operator std::string() const Version::operator std::string() const
{ {
return std::format("{}.{}.{}", Major(), Minor(), Patch()); return std::format("{}.{}.{}", GetMajor(), GetMinor(), GetPatch());
} }
} // namespace Bigfoot } // namespace Bigfoot

View File

@@ -38,19 +38,19 @@ TEST_F(AssetFixture, AssetATests)
AssetA assetA_dup {test}; AssetA assetA_dup {test};
EXPECT_EQ(assetA.Header().uuid, assetA_dup.Header().uuid); EXPECT_EQ(assetA.GetHeader().uuid, assetA_dup.GetHeader().uuid);
EXPECT_EQ(assetA.Header().type_id, AssetA::TypeID()); EXPECT_EQ(assetA.GetHeader().type_id, AssetA::GetTypeID());
EXPECT_EQ(assetA.Header().type_id, assetA_dup.Header().type_id); EXPECT_EQ(assetA.GetHeader().type_id, assetA_dup.GetHeader().type_id);
EXPECT_EQ(assetA.Header().type_name, AssetA::TypeName()); EXPECT_EQ(assetA.GetHeader().type_name, AssetA::GetTypeName());
EXPECT_EQ(assetA.Header().type_name, assetA_dup.Header().type_name); EXPECT_EQ(assetA.GetHeader().type_name, assetA_dup.GetHeader().type_name);
EXPECT_EQ(assetA.Header().name, name); EXPECT_EQ(assetA.GetHeader().name, name);
EXPECT_EQ(assetA.Header().name, assetA_dup.Header().name); EXPECT_EQ(assetA.GetHeader().name, assetA_dup.GetHeader().name);
EXPECT_EQ(assetA.Header().version, version); EXPECT_EQ(assetA.GetHeader().version, version);
EXPECT_EQ(assetA.Header().version, assetA_dup.Header().version); EXPECT_EQ(assetA.GetHeader().version, assetA_dup.GetHeader().version);
EXPECT_EQ(assetA.GetAsset().health, health); EXPECT_EQ(assetA.GetAsset().health, health);
EXPECT_EQ(assetA.GetAsset().health, assetA_dup.GetAsset().health); EXPECT_EQ(assetA.GetAsset().health, assetA_dup.GetAsset().health);
@@ -91,34 +91,34 @@ TEST_F(AssetFixture, AssetBTests)
AssetB assetB; AssetB assetB;
assetB.SetName(nameB); assetB.SetName(nameB);
assetB.SetVersion(versionB); assetB.SetVersion(versionB);
assetB.GetAsset().asset_a_ref = HardReference<AssetA> {assetA.Header().uuid}; assetB.GetAsset().asset_a_ref = HardReference<AssetA> {assetA.GetHeader().uuid};
assetB.GetAsset().asset_a_refs = {SoftReference<AssetA> {assetA.Header().uuid}, assetB.GetAsset().asset_a_refs = {SoftReference<AssetA> {assetA.GetHeader().uuid},
SoftReference<AssetA> {assetAA.Header().uuid}}; SoftReference<AssetA> {assetAA.GetHeader().uuid}};
const eastl::vector<std::byte> test = assetB.Save(); const eastl::vector<std::byte> test = assetB.Save();
AssetB assetB_dup {test}; AssetB assetB_dup {test};
EXPECT_EQ(assetB.Header().uuid, assetB_dup.Header().uuid); EXPECT_EQ(assetB.GetHeader().uuid, assetB_dup.GetHeader().uuid);
EXPECT_EQ(assetB.Header().type_id, AssetB::TypeID()); EXPECT_EQ(assetB.GetHeader().type_id, AssetB::GetTypeID());
EXPECT_EQ(assetB.Header().type_id, assetB_dup.Header().type_id); EXPECT_EQ(assetB.GetHeader().type_id, assetB_dup.GetHeader().type_id);
EXPECT_EQ(assetB.Header().type_name, AssetB::TypeName()); EXPECT_EQ(assetB.GetHeader().type_name, AssetB::GetTypeName());
EXPECT_EQ(assetB.Header().type_name, assetB_dup.Header().type_name); EXPECT_EQ(assetB.GetHeader().type_name, assetB_dup.GetHeader().type_name);
EXPECT_EQ(assetB.Header().name, nameB); EXPECT_EQ(assetB.GetHeader().name, nameB);
EXPECT_EQ(assetB.Header().name, assetB_dup.Header().name); EXPECT_EQ(assetB.GetHeader().name, assetB_dup.GetHeader().name);
EXPECT_EQ(assetB.Header().version, versionB); EXPECT_EQ(assetB.GetHeader().version, versionB);
EXPECT_EQ(assetB.Header().version, assetB_dup.Header().version); EXPECT_EQ(assetB.GetHeader().version, assetB_dup.GetHeader().version);
EXPECT_EQ(assetB.GetAsset().asset_a_ref, HardReference<AssetA> {assetA.Header().uuid}); EXPECT_EQ(assetB.GetAsset().asset_a_ref, HardReference<AssetA> {assetA.GetHeader().uuid});
EXPECT_EQ(assetB.GetAsset().asset_a_ref, assetB_dup.GetAsset().asset_a_ref); EXPECT_EQ(assetB.GetAsset().asset_a_ref, assetB_dup.GetAsset().asset_a_ref);
EXPECT_EQ(assetB.GetAsset().asset_a_refs, EXPECT_EQ(assetB.GetAsset().asset_a_refs,
(eastl::vector<SoftReference<AssetA>> {SoftReference<AssetA> {assetA.Header().uuid}, (eastl::vector<SoftReference<AssetA>> {SoftReference<AssetA> {assetA.GetHeader().uuid},
SoftReference<AssetA> {assetAA.Header().uuid}})); SoftReference<AssetA> {assetAA.GetHeader().uuid}}));
EXPECT_EQ(assetB.GetAsset().asset_a_refs, assetB_dup.GetAsset().asset_a_refs); EXPECT_EQ(assetB.GetAsset().asset_a_refs, assetB_dup.GetAsset().asset_a_refs);
} }
@@ -154,9 +154,9 @@ TEST_F(AssetFixture, AssetCTests)
AssetB assetB; AssetB assetB;
assetB.SetName(nameB); assetB.SetName(nameB);
assetB.SetVersion(versionB); assetB.SetVersion(versionB);
assetB.GetAsset().asset_a_ref = HardReference<AssetA> {assetA.Header().uuid}; assetB.GetAsset().asset_a_ref = HardReference<AssetA> {assetA.GetHeader().uuid};
assetB.GetAsset().asset_a_refs = {SoftReference<AssetA> {assetA.Header().uuid}, assetB.GetAsset().asset_a_refs = {SoftReference<AssetA> {assetA.GetHeader().uuid},
SoftReference<AssetA> {assetAA.Header().uuid}}; SoftReference<AssetA> {assetAA.GetHeader().uuid}};
constexpr eastl::string_view nameC = "General"; constexpr eastl::string_view nameC = "General";
constexpr std::uint32_t versionC = 1; constexpr std::uint32_t versionC = 1;
@@ -164,43 +164,43 @@ TEST_F(AssetFixture, AssetCTests)
AssetC assetC; AssetC assetC;
assetC.SetName(nameC); assetC.SetName(nameC);
assetC.SetVersion(versionC); assetC.SetVersion(versionC);
assetC.GetAsset().inner_table->asset_a_ref = HardReference<AssetA> {assetA.Header().uuid}; assetC.GetAsset().inner_table->asset_a_ref = HardReference<AssetA> {assetA.GetHeader().uuid};
assetC.GetAsset().inner_table->asset_a_refs = {HardReference<AssetA> {assetA.Header().uuid}, assetC.GetAsset().inner_table->asset_a_refs = {HardReference<AssetA> {assetA.GetHeader().uuid},
HardReference<AssetA> {assetAA.Header().uuid}}; HardReference<AssetA> {assetAA.GetHeader().uuid}};
assetC.GetAsset().asset_b_ref = HardReference<AssetB> {assetB.Header().uuid}; assetC.GetAsset().asset_b_ref = HardReference<AssetB> {assetB.GetHeader().uuid};
assetC.GetAsset().asset_b_refs = {SoftReference<AssetB> {assetB.Header().uuid}}; assetC.GetAsset().asset_b_refs = {SoftReference<AssetB> {assetB.GetHeader().uuid}};
const eastl::vector<std::byte> test = assetC.Save(); const eastl::vector<std::byte> test = assetC.Save();
AssetC assetC_dup {test}; AssetC assetC_dup {test};
EXPECT_EQ(assetC.Header().uuid, assetC_dup.Header().uuid); EXPECT_EQ(assetC.GetHeader().uuid, assetC_dup.GetHeader().uuid);
EXPECT_EQ(assetC.Header().type_id, AssetC::TypeID()); EXPECT_EQ(assetC.GetHeader().type_id, AssetC::GetTypeID());
EXPECT_EQ(assetC.Header().type_id, assetC_dup.Header().type_id); EXPECT_EQ(assetC.GetHeader().type_id, assetC_dup.GetHeader().type_id);
EXPECT_EQ(assetC.Header().type_name, AssetC::TypeName()); EXPECT_EQ(assetC.GetHeader().type_name, AssetC::GetTypeName());
EXPECT_EQ(assetC.Header().type_name, assetC_dup.Header().type_name); EXPECT_EQ(assetC.GetHeader().type_name, assetC_dup.GetHeader().type_name);
EXPECT_EQ(assetC.Header().name, nameC); EXPECT_EQ(assetC.GetHeader().name, nameC);
EXPECT_EQ(assetC.Header().name, assetC_dup.Header().name); EXPECT_EQ(assetC.GetHeader().name, assetC_dup.GetHeader().name);
EXPECT_EQ(assetC.Header().version, versionC); EXPECT_EQ(assetC.GetHeader().version, versionC);
EXPECT_EQ(assetC.Header().version, assetC_dup.Header().version); EXPECT_EQ(assetC.GetHeader().version, assetC_dup.GetHeader().version);
EXPECT_EQ(assetC.GetAsset().asset_b_ref, HardReference<AssetB> {assetB.Header().uuid}); EXPECT_EQ(assetC.GetAsset().asset_b_ref, HardReference<AssetB> {assetB.GetHeader().uuid});
EXPECT_EQ(assetC.GetAsset().asset_b_ref, assetC_dup.GetAsset().asset_b_ref); EXPECT_EQ(assetC.GetAsset().asset_b_ref, assetC_dup.GetAsset().asset_b_ref);
EXPECT_EQ(assetC.GetAsset().asset_b_refs, EXPECT_EQ(assetC.GetAsset().asset_b_refs,
(eastl::vector<SoftReference<AssetB>> {SoftReference<AssetB> {assetB.Header().uuid}})); (eastl::vector<SoftReference<AssetB>> {SoftReference<AssetB> {assetB.GetHeader().uuid}}));
EXPECT_EQ(assetC.GetAsset().asset_b_refs, assetC_dup.GetAsset().asset_b_refs); EXPECT_EQ(assetC.GetAsset().asset_b_refs, assetC_dup.GetAsset().asset_b_refs);
EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_ref, HardReference<AssetA> {assetA.Header().uuid}); EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_ref, HardReference<AssetA> {assetA.GetHeader().uuid});
EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_ref, assetC_dup.GetAsset().inner_table->asset_a_ref); EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_ref, assetC_dup.GetAsset().inner_table->asset_a_ref);
EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_refs, EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_refs,
(eastl::vector<HardReference<AssetA>> {HardReference<AssetA> {assetA.Header().uuid}, (eastl::vector<HardReference<AssetA>> {HardReference<AssetA> {assetA.GetHeader().uuid},
HardReference<AssetA> {assetAA.Header().uuid}})); HardReference<AssetA> {assetAA.GetHeader().uuid}}));
EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_refs, assetC_dup.GetAsset().inner_table->asset_a_refs); EXPECT_EQ(assetC.GetAsset().inner_table->asset_a_refs, assetC_dup.GetAsset().inner_table->asset_a_refs);
} }
} // namespace Bigfoot } // namespace Bigfoot

View File

@@ -44,11 +44,11 @@ TEST_F(AssetContainerFixture, Get)
/****************************************************************************************/ /****************************************************************************************/
TEST_F(AssetContainerFixture, SlotKey) TEST_F(AssetContainerFixture, GetSlotKey)
{ {
const auto key = m_container.Insert(); const auto key = m_container.Insert();
const auto asset = m_container.Get(key); const auto asset = m_container.Get(key);
EXPECT_EQ(m_container.SlotKey(asset->Header().uuid), key); EXPECT_EQ(m_container.GetSlotKey(asset->GetHeader().uuid), key);
} }
/****************************************************************************************/ /****************************************************************************************/
@@ -57,7 +57,7 @@ TEST_F(AssetContainerFixture, Has)
{ {
const auto key = m_container.Insert(); const auto key = m_container.Insert();
EXPECT_TRUE(m_container.Has(key)); EXPECT_TRUE(m_container.Has(key));
EXPECT_TRUE(m_container.Has(m_container.Get(key)->Header().uuid)); EXPECT_TRUE(m_container.Has(m_container.Get(key)->GetHeader().uuid));
} }
/****************************************************************************************/ /****************************************************************************************/
@@ -68,6 +68,6 @@ TEST_F(AssetContainerFixture, Remove)
m_container.Remove(key1); m_container.Remove(key1);
const auto key2 = m_container.Insert(); const auto key2 = m_container.Insert();
m_container.Remove(m_container.Get(key2)->Header().uuid); m_container.Remove(m_container.Get(key2)->GetHeader().uuid);
} }
} // namespace Bigfoot } // namespace Bigfoot

View File

@@ -135,13 +135,13 @@ TEST_F(BigFileFixture, BigFileManipulation)
const Time createTime = static_cast<std::uint64_t>(request.Get(3)); const Time createTime = static_cast<std::uint64_t>(request.Get(3));
const Time modificationTime = static_cast<std::uint64_t>(request.Get(4)); const Time modificationTime = static_cast<std::uint64_t>(request.Get(4));
EXPECT_GT(createTime.Epoch(), 0); EXPECT_GT(createTime.GetEpoch(), 0);
EXPECT_GT(modificationTime.Epoch(), 0); EXPECT_GT(modificationTime.GetEpoch(), 0);
EXPECT_GE(createTime, modificationTime); EXPECT_GE(createTime, modificationTime);
EXPECT_GT(createTime.Year(), 2025); EXPECT_GT(createTime.GetYear(), 2025);
EXPECT_GT(modificationTime.Year(), 2025); EXPECT_GT(modificationTime.GetYear(), 2025);
} }
} }
} // namespace Bigfoot } // namespace Bigfoot

View File

@@ -28,14 +28,14 @@ TEST_F(FileFixture, IsRelative_ShouldReturnTrueOnRelativeFile)
TEST_F(FileFixture, IsRelative_ShouldReturnFalseOnAbsoluteFile) TEST_F(FileFixture, IsRelative_ShouldReturnFalseOnAbsoluteFile)
{ {
EXPECT_FALSE(m_file.Absolute().IsRelative()); EXPECT_FALSE(m_file.ToAbsolute().IsRelative());
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(FileFixture, IsAbsolute_ShouldReturnTrueOnAbsoluteFile) TEST_F(FileFixture, IsAbsolute_ShouldReturnTrueOnAbsoluteFile)
{ {
EXPECT_TRUE(m_file.Absolute().IsAbsolute()); EXPECT_TRUE(m_file.ToAbsolute().IsAbsolute());
} }
TEST_F(FileFixture, IsAbsolute_ShouldReturnFalseOnRelativeFile) TEST_F(FileFixture, IsAbsolute_ShouldReturnFalseOnRelativeFile)
@@ -59,22 +59,22 @@ TEST_F(FileFixture, Exists_ShouldReturnFalseOnNonExistingFile)
/****************************************************************************************/ /****************************************************************************************/
TEST_F(FileFixture, Path_ShouldReturnThePath) TEST_F(FileFixture, GetPath_ShouldReturnThePath)
{ {
EXPECT_STREQ(m_file.Path().data(), "Fixture/file"); EXPECT_STREQ(m_file.GetPath().data(), "Fixture/file");
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(FileFixture, Absolute_ShouldReturnTheAbsolutePath) TEST_F(FileFixture, ToAbsolute_ShouldReturnTheAbsolutePath)
{ {
EXPECT_STREQ(std::filesystem::absolute("Fixture/file").string().c_str(), m_file.Absolute().Path().data()); EXPECT_STREQ(std::filesystem::absolute("Fixture/file").string().c_str(), m_file.ToAbsolute().GetPath().data());
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(FileFixture, Relative_ShouldReturnTheRelativePath) TEST_F(FileFixture, ToRelative_ShouldReturnTheRelativePath)
{ {
EXPECT_STREQ(std::filesystem::relative("Fixture/file").string().c_str(), m_file.Relative().Path().data()); EXPECT_STREQ(std::filesystem::relative("Fixture/file").string().c_str(), m_file.ToRelative().GetPath().data());
} }
} // namespace Bigfoot } // namespace Bigfoot

View File

@@ -18,50 +18,50 @@ class TimeFixture: public ::testing::Test
/****************************************************************************************/ /****************************************************************************************/
TEST_F(TimeFixture, Year_ShouldReturnTheYear) TEST_F(TimeFixture, GetYear_ShouldReturnTheYear)
{ {
EXPECT_EQ(m_time.Year(), 2026); EXPECT_EQ(m_time.GetYear(), 2026);
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(TimeFixture, Month_ShouldReturnTheMonth) TEST_F(TimeFixture, GetMonth_ShouldReturnTheMonth)
{ {
EXPECT_EQ(m_time.Month(), 1); EXPECT_EQ(m_time.GetMonth(), 1);
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(TimeFixture, Day_ShouldReturnTheDay) TEST_F(TimeFixture, GetDay_ShouldReturnTheDay)
{ {
EXPECT_EQ(m_time.Day(), 5); EXPECT_EQ(m_time.GetDay(), 5);
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(TimeFixture, Hour_ShouldReturnTheHour) TEST_F(TimeFixture, GetHour_ShouldReturnTheHour)
{ {
EXPECT_EQ(m_time.Hour(), 20); EXPECT_EQ(m_time.GetHour(), 20);
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(TimeFixture, Minute_ShouldReturnTheMinute) TEST_F(TimeFixture, GetMinute_ShouldReturnTheMinute)
{ {
EXPECT_EQ(m_time.Minute(), 9); EXPECT_EQ(m_time.GetMinute(), 9);
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(TimeFixture, Second_ShouldReturnTheSecond) TEST_F(TimeFixture, GetSecond_ShouldReturnTheSecond)
{ {
EXPECT_EQ(m_time.Second(), 6); EXPECT_EQ(m_time.GetSecond(), 6);
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(TimeFixture, Microsecond_ShouldReturnTheMicrosecond) TEST_F(TimeFixture, GetMicrosecond_ShouldReturnTheMicrosecond)
{ {
EXPECT_EQ(m_time.Microsecond(), 680'609); EXPECT_EQ(m_time.GetMicrosecond(), 680'609);
} }
} // namespace Bigfoot } // namespace Bigfoot

View File

@@ -60,8 +60,8 @@ TYPED_TEST(SlotKeyFixture, DefaultSlotKeyIsInvalid)
constexpr typename TestFixture::SlotKey slotKey {}; constexpr typename TestFixture::SlotKey slotKey {};
EXPECT_FALSE(slotKey.Valid()); EXPECT_FALSE(slotKey.Valid());
EXPECT_EQ(slotKey.Version(), version); EXPECT_EQ(slotKey.GetVersion(), version);
EXPECT_EQ(slotKey.Index(), index); EXPECT_EQ(slotKey.GetIndex(), index);
} }
/****************************************************************************************/ /****************************************************************************************/
@@ -88,24 +88,24 @@ TYPED_TEST(SlotKeyFixture, Valid_ShouldReturnFalseIfTheSlotKeyIsValid)
/****************************************************************************************/ /****************************************************************************************/
TYPED_TEST(SlotKeyFixture, Version_ShouldReturnTheVersion) TYPED_TEST(SlotKeyFixture, GetVersion_ShouldReturnTheVersion)
{ {
constexpr typename TestFixture::SlotMapIndex index = 0; constexpr typename TestFixture::SlotMapIndex index = 0;
constexpr typename TestFixture::SlotMapVersion version = 42; constexpr typename TestFixture::SlotMapVersion version = 42;
constexpr typename TestFixture::SlotKey slotKey {version, index}; constexpr typename TestFixture::SlotKey slotKey {version, index};
EXPECT_EQ(slotKey.Version(), version); EXPECT_EQ(slotKey.GetVersion(), version);
} }
/****************************************************************************************/ /****************************************************************************************/
TYPED_TEST(SlotKeyFixture, Index_ShouldReturnTheIndex) TYPED_TEST(SlotKeyFixture, GetIndex_ShouldReturnTheIndex)
{ {
constexpr typename TestFixture::SlotMapIndex index = 42; constexpr typename TestFixture::SlotMapIndex index = 42;
constexpr typename TestFixture::SlotMapVersion version = 0; constexpr typename TestFixture::SlotMapVersion version = 0;
constexpr typename TestFixture::SlotKey slotKey {version, index}; constexpr typename TestFixture::SlotKey slotKey {version, index};
EXPECT_EQ(slotKey.Index(), index); EXPECT_EQ(slotKey.GetIndex(), index);
} }
/****************************************************************************************/ /****************************************************************************************/
@@ -140,8 +140,8 @@ TYPED_TEST(SlotMapFixture, Insert_ShouldRecycleASlotKeyAfterARemove)
this->m_slotMap.Remove(slotKey); this->m_slotMap.Remove(slotKey);
const auto secondSlotKey = this->m_slotMap.Insert(69); const auto secondSlotKey = this->m_slotMap.Insert(69);
EXPECT_NE(secondSlotKey.Version(), slotKey.Version()); EXPECT_NE(secondSlotKey.GetVersion(), slotKey.GetVersion());
EXPECT_EQ(secondSlotKey.Index(), slotKey.Index()); EXPECT_EQ(secondSlotKey.GetIndex(), slotKey.GetIndex());
} }
/****************************************************************************************/ /****************************************************************************************/
@@ -190,19 +190,19 @@ TYPED_TEST(SlotMapFixture, Remove_ShouldNotRecycleASlotWhenVersionWasExhausted)
{ {
this->m_slotMap.Remove(key); this->m_slotMap.Remove(key);
const auto newKey = this->m_slotMap.Insert(1); const auto newKey = this->m_slotMap.Insert(1);
EXPECT_EQ(newKey.Index(), key.Index()); EXPECT_EQ(newKey.GetIndex(), key.GetIndex());
key = newKey; key = newKey;
} }
// Slot is at MAX_VERSION — one more remove should overflow and permanently deactivate it // Slot is at MAX_VERSION — one more remove should overflow and permanently deactivate it
EXPECT_EQ(key.Version(), std::numeric_limits<typename TestFixture::SlotMapVersion>::max()); EXPECT_EQ(key.GetVersion(), std::numeric_limits<typename TestFixture::SlotMapVersion>::max());
this->m_slotMap.Remove(key); this->m_slotMap.Remove(key);
EXPECT_FALSE(this->m_slotMap.Has(key)); EXPECT_FALSE(this->m_slotMap.Has(key));
// Dead slot must not be recycled; a new insert must allocate a fresh slot index // Dead slot must not be recycled; a new insert must allocate a fresh slot index
const auto newKey = this->m_slotMap.Insert(2); const auto newKey = this->m_slotMap.Insert(2);
EXPECT_NE(newKey.Index(), key.Index()); EXPECT_NE(newKey.GetIndex(), key.GetIndex());
// Ensure an invalid key does not return an exhausted slot // Ensure an invalid key does not return an exhausted slot
EXPECT_EQ(this->m_slotMap.Get(typename TestFixture::SlotKey {}), nullptr); EXPECT_EQ(this->m_slotMap.Get(typename TestFixture::SlotKey {}), nullptr);
@@ -313,35 +313,35 @@ TYPED_TEST(SlotMapFixture, Clear_ResetsTheSlotMapAndButGuaranteesNotCollisionWit
/****************************************************************************************/ /****************************************************************************************/
TYPED_TEST(SlotMapFixture, Size_ReturnTheSizeOfTheSlotMap) TYPED_TEST(SlotMapFixture, GetSize_ReturnTheSizeOfTheSlotMap)
{ {
EXPECT_EQ(this->m_slotMap.Size(), 0); EXPECT_EQ(this->m_slotMap.GetSize(), 0);
std::ignore = this->m_slotMap.Insert(42); std::ignore = this->m_slotMap.Insert(42);
const auto slotKey2 = this->m_slotMap.Insert(69); const auto slotKey2 = this->m_slotMap.Insert(69);
std::ignore = this->m_slotMap.Insert(28); std::ignore = this->m_slotMap.Insert(28);
std::ignore = this->m_slotMap.Insert(0); std::ignore = this->m_slotMap.Insert(0);
EXPECT_EQ(this->m_slotMap.Size(), 4); EXPECT_EQ(this->m_slotMap.GetSize(), 4);
this->m_slotMap.Remove(slotKey2); this->m_slotMap.Remove(slotKey2);
EXPECT_EQ(this->m_slotMap.Size(), 3); EXPECT_EQ(this->m_slotMap.GetSize(), 3);
this->m_slotMap.Clear(); this->m_slotMap.Clear();
EXPECT_EQ(this->m_slotMap.Size(), 0); EXPECT_EQ(this->m_slotMap.GetSize(), 0);
std::ignore = this->m_slotMap.Insert(42); std::ignore = this->m_slotMap.Insert(42);
std::ignore = this->m_slotMap.Insert(69); std::ignore = this->m_slotMap.Insert(69);
std::ignore = this->m_slotMap.Insert(28); std::ignore = this->m_slotMap.Insert(28);
std::ignore = this->m_slotMap.Insert(0); std::ignore = this->m_slotMap.Insert(0);
EXPECT_EQ(this->m_slotMap.Size(), 4); EXPECT_EQ(this->m_slotMap.GetSize(), 4);
this->m_slotMap.Reset(); this->m_slotMap.Reset();
EXPECT_EQ(this->m_slotMap.Size(), 0); EXPECT_EQ(this->m_slotMap.GetSize(), 0);
} }
/****************************************************************************************/ /****************************************************************************************/

View File

@@ -42,7 +42,7 @@ class SingletonTest
} }
[[nodiscard]] [[nodiscard]]
std::uint32_t Data() const std::uint32_t GetData() const
{ {
return m_data; return m_data;
} }
@@ -92,11 +92,11 @@ TEST_F(SingletonFixture, ConstructorAndDestructorShouldBeCalled)
/****************************************************************************************/ /****************************************************************************************/
TEST_F(SingletonFixture, Instance_ShouldReturnTheInstance) TEST_F(SingletonFixture, GetInstance_ShouldReturnTheInstance)
{ {
Singleton<SingletonTest>::Lifetime singleton {42}; Singleton<SingletonTest>::Lifetime singleton {42};
EXPECT_EQ(Singleton<SingletonTest>::Instance().Data(), 42); EXPECT_EQ(Singleton<SingletonTest>::GetInstance().GetData(), 42);
} }
} // namespace Bigfoot } // namespace Bigfoot

View File

@@ -35,26 +35,26 @@ TEST_F(VersionFixture, uint32_t)
/****************************************************************************************/ /****************************************************************************************/
TEST_F(VersionFixture, Major_ShouldBeEqualToTheMajorPartOfTheVersion) TEST_F(VersionFixture, GetMajor_ShouldBeEqualToTheMajorPartOfTheVersion)
{ {
EXPECT_EQ(m_detailed.Major(), 1); EXPECT_EQ(m_detailed.GetMajor(), 1);
EXPECT_EQ(m_combined.Major(), 1); EXPECT_EQ(m_combined.GetMajor(), 1);
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(VersionFixture, Minor_ShouldBeEqualToTheMinorPartOfTheVersion) TEST_F(VersionFixture, GetMinor_ShouldBeEqualToTheMinorPartOfTheVersion)
{ {
EXPECT_EQ(m_detailed.Minor(), 2); EXPECT_EQ(m_detailed.GetMinor(), 2);
EXPECT_EQ(m_combined.Minor(), 2); EXPECT_EQ(m_combined.GetMinor(), 2);
} }
/****************************************************************************************/ /****************************************************************************************/
TEST_F(VersionFixture, Patch_ShouldBeEqualToThePatchPartOfTheVersion) TEST_F(VersionFixture, GetPatch_ShouldBeEqualToThePatchPartOfTheVersion)
{ {
EXPECT_EQ(m_detailed.Patch(), 3); EXPECT_EQ(m_detailed.GetPatch(), 3);
EXPECT_EQ(m_combined.Patch(), 3); EXPECT_EQ(m_combined.GetPatch(), 3);
} }
/****************************************************************************************/ /****************************************************************************************/