AssetContainer semantic
Some checks failed
Bigfoot / Build & Test Debug (Unity Build: OFF) (push) Failing after 2m58s
Bigfoot / Build & Test Debug (Unity Build: ON) (push) Failing after 1m10s
Bigfoot / Build & Test RelWithDebInfo (Unity Build: OFF) (push) Failing after 1m47s
Bigfoot / Build & Test RelWithDebInfo (Unity Build: ON) (push) Failing after 1m38s
Bigfoot / Build & Test Release (Unity Build: OFF) (push) Failing after 1m36s
Bigfoot / Build & Test Release (Unity Build: ON) (push) Failing after 1m23s
Bigfoot / Clang Format Checks (push) Successful in 11s

This commit is contained in:
2026-02-13 18:43:21 +01:00
parent d6df6d8a71
commit a21354b4b4
3 changed files with 130 additions and 25 deletions

View File

@@ -15,6 +15,7 @@
#include <Utils/Singleton.hpp>
#include <Utils/TargetMacros.h>
#include <EngineTests/BigFile/Asset/AssetA.hpp>
#include <EngineTests/BigFile/Asset/AssetA_generated.hpp>
#include <EngineTests/BigFileInfo_generated.hpp>
@@ -36,7 +37,7 @@ class BigFileFixture: public ::testing::Test
m_bigFile.CommitTransaction();
}
FlatAssetWrapper<Flat::AssetA> test;
AssetAContainer m_assetAContainer;
BIGFOOT_NOT_OPTIMIZED_ONLY(Singleton<Log>::Lifetime m_loggerLifetime;)
@@ -48,31 +49,36 @@ class BigFileFixture: public ::testing::Test
TEST_F(BigFileFixture, Lol)
{
{
UUID uuid;
test.Asset().health = 100;
test.Asset().mana = 42;
test.Asset().asset_header->name = "Instance";
test.Asset().asset_header->uuid = uuid;
test.Asset().asset_header->version = 2;
const eastl::vector<std::byte> flatbuffer = test.Pack();
EXPECT_STREQ(FlatAssetWrapper<Flat::AssetA>::TypeName().data(), "Bigfoot.Flat.AssetA");
EXPECT_EQ(FlatAssetWrapper<Flat::AssetA>::TypeID(),
rapidhash(FlatAssetWrapper<Flat::AssetA>::TypeName().data(),
FlatAssetWrapper<Flat::AssetA>::TypeName().size()));
FlatAssetWrapper<Flat::AssetA> test2 {flatbuffer};
EXPECT_EQ(test2.Asset().health, 100);
EXPECT_EQ(test2.Asset().mana, 42);
UUID uuid;
std::ignore = m_assetAContainer.Add(uuid, "Instance");
EXPECT_STREQ(test2.Asset().asset_header->name.c_str(), "Instance");
EXPECT_EQ(test2.Asset().asset_header->type_id, FlatAssetWrapper<Flat::AssetA>::TypeID());
EXPECT_STREQ(test2.Asset().asset_header->type_name.c_str(), FlatAssetWrapper<Flat::AssetA>::TypeName().data());
EXPECT_EQ(test2.Asset().asset_header->uuid, uuid);
EXPECT_EQ(test2.Asset().asset_header->version, 2);
AssetA* test = m_assetAContainer.Get(uuid);
test->Health() = 100;
test->Mana() = 42;
const eastl::vector<std::byte> flatbuffer = m_assetAContainer.Pack(uuid);
m_assetAContainer.Remove(uuid);
std::ignore = m_assetAContainer.Add(uuid, flatbuffer);
std::ignore = m_assetAContainer.Add(UUID {}, "Instance2");
std::ignore = m_assetAContainer.Add(UUID {}, "Instance3");
AssetA* test2 = m_assetAContainer.Get(uuid);
EXPECT_EQ(test2->Health(), 100);
EXPECT_EQ(test2->Mana(), 42);
EXPECT_STREQ(test2->AssetHeader()->name.c_str(), "Instance");
EXPECT_EQ(test2->AssetHeader()->type_id, FlatAssetWrapper<Flat::AssetA>::TypeID());
EXPECT_STREQ(test2->AssetHeader()->type_name.c_str(), FlatAssetWrapper<Flat::AssetA>::TypeName().data());
EXPECT_EQ(test2->AssetHeader()->uuid, uuid);
EXPECT_EQ(test2->AssetHeader()->version, 2);
}
UUID uuid;