BigFile/Sasquatch #1

Merged
rboullard merged 100 commits from BigFile into Development 2026-09-01 16:32:02 +00:00
3 changed files with 5 additions and 50 deletions
Showing only changes of commit 1b9e17d6bc - Show all commits
@@ -130,7 +130,6 @@ class Asset: public AssetBase
flatbuffers::GetRoot<FLAT_ASSET>(asset->inner_asset()->data())->UnPackTo(&m_asset, nullptr);
}
#ifdef BIGFOOT_TOOLMODE
/**
* Pack the asset to a flatbuffer
*
@@ -150,7 +149,6 @@ class Asset: public AssetBase
return eastl::vector<std::byte> {std::bit_cast<std::byte*>(assetFbb.GetBufferPointer()),
std::bit_cast<std::byte*>(assetFbb.GetBufferPointer() + assetFbb.GetSize())};
}
#endif
/**
* Get the AssetTypeID
-47
View File
@@ -16,26 +16,6 @@ namespace Bigfoot
class AssetFixture: public ::testing::Test
{
protected:
/**
* Packs a header and an asset the same way Asset<ASSET>::Pack() does. Pack() is intentionally
* BIGFOOT_TOOLMODE-only: game code must never be able to build asset buffers.
*/
template<class ASSET>
static eastl::vector<std::byte> PackAssetBuffer(const ::Flat::Bigfoot::AssetHeaderT& p_header,
const typename ASSET::FLAT_ASSET::NativeTableType& p_asset)
{
flatbuffers::FlatBufferBuilder innerAssetFbb;
innerAssetFbb.Finish(ASSET::FLAT_ASSET::Pack(innerAssetFbb, &p_asset));
flatbuffers::FlatBufferBuilder assetFbb;
const auto header = ::Flat::Bigfoot::AssetHeader::Pack(assetFbb, &p_header);
const auto innerAsset = assetFbb.CreateVector(innerAssetFbb.GetBufferPointer(), innerAssetFbb.GetSize());
assetFbb.Finish(::Flat::Bigfoot::CreateAsset(assetFbb, header, innerAsset));
return eastl::vector<std::byte> {std::bit_cast<std::byte*>(assetFbb.GetBufferPointer()),
std::bit_cast<std::byte*>(assetFbb.GetBufferPointer() + assetFbb.GetSize())};
}
AssetA m_asset;
};
@@ -100,32 +80,6 @@ TEST_F(AssetFixture, GetTypeName_ShouldReturnTheFlatbufferFullyQualifiedName)
/****************************************************************************************/
TEST_F(AssetFixture, Unpack_ShouldPopulateTheHeaderAndTheAsset)
{
::Flat::Bigfoot::AssetHeaderT header;
header.name = "MyAsset";
header.version = 3;
header.type_id = AssetA::GetTypeID();
header.type_name = eastl::string {AssetA::GetTypeName()};
AssetA::FLAT_ASSET::NativeTableType inner;
inner.health = 42;
inner.mana = 7;
m_asset.Unpack(PackAssetBuffer<AssetA>(header, inner));
EXPECT_EQ(m_asset.GetHeader().uuid, header.uuid);
EXPECT_STREQ(m_asset.GetHeader().name.c_str(), header.name.c_str());
EXPECT_EQ(m_asset.GetHeader().version, header.version);
EXPECT_EQ(m_asset.GetHeader().type_id, header.type_id);
EXPECT_STREQ(m_asset.GetHeader().type_name.c_str(), header.type_name.c_str());
EXPECT_EQ(m_asset.GetAsset().health, 42);
EXPECT_EQ(m_asset.GetAsset().mana, 7);
}
/****************************************************************************************/
#ifdef BIGFOOT_TOOLMODE
TEST_F(AssetFixture, PackThenUnpack_ShouldRoundTripTheHeaderAndTheAsset)
{
m_asset.SetName("MyAsset");
@@ -144,5 +98,4 @@ TEST_F(AssetFixture, PackThenUnpack_ShouldRoundTripTheHeaderAndTheAsset)
EXPECT_EQ(unpacked.GetAsset().health, m_asset.GetAsset().health);
EXPECT_EQ(unpacked.GetAsset().mana, m_asset.GetAsset().mana);
}
#endif
} // namespace Bigfoot
@@ -141,7 +141,11 @@ TEST_F(AssetContainerFixture, Insert_ShouldReturnValidAndUniqueSlotKeyOnInsert)
TEST_F(AssetContainerFixture, Insert_ShouldReturnTheSameSlotKeyInCaseOfDuplicatedUUID)
{
const SlotMapKey slotKey = m_containerA.Insert();
EXPECT_EQ(slotKey, m_containerA.Insert());
AssetA duplicate;
duplicate.Unpack(m_containerA.Get(slotKey)->Pack());
EXPECT_EQ(slotKey, m_containerA.Insert(std::move(duplicate)));
}
/****************************************************************************************/