BigFile/Sasquatch #1
@@ -114,7 +114,6 @@ class Version
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
template<>
|
||||
struct fmt::formatter<Bigfoot::Version>
|
||||
{
|
||||
@@ -131,4 +130,3 @@ struct fmt::formatter<Bigfoot::Version>
|
||||
}
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*********************************************************************
|
||||
* \file AssetTypeID.cpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date August 2026
|
||||
*********************************************************************/
|
||||
#include <Engine/Asset/AssetTypeID.hpp>
|
||||
|
||||
#include <Engine/Asset/AssetTypeID_generated.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <limits>
|
||||
|
||||
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
|
||||
@@ -6,6 +6,8 @@
|
||||
*********************************************************************/
|
||||
#include <System/Time/Time.hpp>
|
||||
|
||||
#include <System/Time/Time_generated.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
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
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
*********************************************************************/
|
||||
#include <System/UUID/UUID.hpp>
|
||||
|
||||
#include <System/UUID/UUID_generated.hpp>
|
||||
|
||||
#include <ankerl/unordered_dense.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user