diff --git a/Bigfoot/Sources/Utils/Include/Utils/Version.hpp b/Bigfoot/Sources/Utils/Include/Utils/Version.hpp index 34b2043..bae34fe 100644 --- a/Bigfoot/Sources/Utils/Include/Utils/Version.hpp +++ b/Bigfoot/Sources/Utils/Include/Utils/Version.hpp @@ -114,7 +114,6 @@ class Version /****************************************************************************************/ -#if defined BIGFOOT_NOT_OPTIMIZED template<> struct fmt::formatter { @@ -131,4 +130,3 @@ struct fmt::formatter } }; #endif -#endif diff --git a/Bigfoot/Tests/Engine/Asset/AssetTypeID.cpp b/Bigfoot/Tests/Engine/Asset/AssetTypeID.cpp new file mode 100644 index 0000000..97c5fa9 --- /dev/null +++ b/Bigfoot/Tests/Engine/Asset/AssetTypeID.cpp @@ -0,0 +1,34 @@ +/********************************************************************* + * \file AssetTypeID.cpp + * + * \author Romain BOULLARD + * \date August 2026 + *********************************************************************/ +#include + +#include + +#include + +#include + +namespace Bigfoot +{ +TEST(AssetTypeID, Pack_ShouldGiveAFlatAssetTypeIDWithTheSameValue) +{ + constexpr AssetTypeID assetTypeID = 42; + + const Flat::Bigfoot::AssetTypeID flatAssetTypeID = flatbuffers::Pack(assetTypeID); + EXPECT_EQ(flatAssetTypeID.value(), assetTypeID); +} + +/****************************************************************************************/ + +TEST(AssetTypeID, UnPack_ShouldGiveBackTheOriginalValue) +{ + constexpr AssetTypeID assetTypeID = 42; + + const Flat::Bigfoot::AssetTypeID flatAssetTypeID = flatbuffers::Pack(assetTypeID); + EXPECT_EQ(flatbuffers::UnPack(flatAssetTypeID), assetTypeID); +} +} // namespace Bigfoot diff --git a/Bigfoot/Tests/System/Time/Time.cpp b/Bigfoot/Tests/System/Time/Time.cpp index ce300d2..ac046ee 100644 --- a/Bigfoot/Tests/System/Time/Time.cpp +++ b/Bigfoot/Tests/System/Time/Time.cpp @@ -6,6 +6,8 @@ *********************************************************************/ #include +#include + #include namespace Bigfoot @@ -64,4 +66,20 @@ TEST_F(TimeFixture, GetMicrosecond_ShouldReturnTheMicrosecond) { EXPECT_EQ(m_time.GetMicrosecond(), 680'609); } + +/****************************************************************************************/ + +TEST_F(TimeFixture, Pack_ShouldGiveAFlatTimeWithTheSameEpoch) +{ + const Flat::Bigfoot::Time flatTime = flatbuffers::Pack(m_time); + EXPECT_EQ(flatTime.epoch(), m_time.GetEpoch()); +} + +/****************************************************************************************/ + +TEST_F(TimeFixture, UnPack_ShouldGiveBackTheOriginalTime) +{ + const Flat::Bigfoot::Time flatTime = flatbuffers::Pack(m_time); + EXPECT_EQ(flatbuffers::UnPack(flatTime), m_time); +} } // namespace Bigfoot diff --git a/Bigfoot/Tests/System/UUID/UUID.cpp b/Bigfoot/Tests/System/UUID/UUID.cpp index debfccf..67bf71a 100644 --- a/Bigfoot/Tests/System/UUID/UUID.cpp +++ b/Bigfoot/Tests/System/UUID/UUID.cpp @@ -6,6 +6,8 @@ *********************************************************************/ #include +#include + #include #include @@ -178,4 +180,32 @@ TEST_F(UUIDFixture, ToBytes_ShouldGiveBackTheRawDataOfTheID) EXPECT_EQ(d[i], raw[i]); } } + +/****************************************************************************************/ + +TEST_F(UUIDFixture, Pack_ShouldGiveAFlatUUIDWithTheSameRawBytes) +{ + const Flat::Bigfoot::UUID flatUUID = flatbuffers::Pack(m_d); + + for (std::uint32_t i = 0; i < UUID::UUID_BYTE_SIZE; ++i) + { + EXPECT_EQ(std::byte {(*flatUUID.bytes())[i]}, m_raw[i]); + } +} + +/****************************************************************************************/ + +TEST_F(UUIDFixture, UnPack_ShouldGiveBackTheOriginalUUID) +{ + const Flat::Bigfoot::UUID flatUUID = flatbuffers::Pack(m_d); + EXPECT_EQ(flatbuffers::UnPack(flatUUID), m_d); +} + +/****************************************************************************************/ + +TEST_F(UUIDFixture, FormatsUUID) +{ + EXPECT_EQ(fmt::format("{}", m_b), m_b.ToString()); + EXPECT_EQ(fmt::format("{}", UUID::NULL_UUID), "00000000-0000-0000-0000-000000000000"); +} } // namespace Bigfoot diff --git a/Bigfoot/Tests/Utils/Version.cpp b/Bigfoot/Tests/Utils/Version.cpp index bba4a02..7c9998b 100644 --- a/Bigfoot/Tests/Utils/Version.cpp +++ b/Bigfoot/Tests/Utils/Version.cpp @@ -70,4 +70,12 @@ TEST_F(VersionFixture, Comparisons) EXPECT_EQ(other, other); EXPECT_NE(other, m_detailed); } + +/****************************************************************************************/ + +TEST_F(VersionFixture, FormatsVersion) +{ + EXPECT_EQ(fmt::format("{}", m_detailed), "1.2.3"); + EXPECT_EQ(fmt::format("{}", m_combined), "1.2.3"); +} } // namespace Bigfoot