Cleaner separation
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m50s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m7s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 5m27s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 5m22s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m40s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m41s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 6m40s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 6m38s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m44s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m45s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 6m16s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 6m20s
Bigfoot / Clang Format Checks (push) Failing after 11s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m50s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m7s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 5m27s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 5m22s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m40s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m41s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 6m40s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 6m38s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m44s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m45s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 6m16s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 6m20s
Bigfoot / Clang Format Checks (push) Failing after 11s
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
/*********************************************************************
|
||||
* \file BigFile.cpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date December 2025
|
||||
*********************************************************************/
|
||||
#include <Engine/Asset/Asset.hpp>
|
||||
|
||||
#include <Engine/EngineLogger_generated.hpp>
|
||||
|
||||
#include <System/Log/Log.hpp>
|
||||
|
||||
#include <Utils/Singleton.hpp>
|
||||
#include <Utils/TargetMacros.h>
|
||||
|
||||
#include <EngineTests/Asset/AssetA.hpp>
|
||||
|
||||
#include <flatbuffers/reflection.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
class AssetFixture: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
void SetUp() override
|
||||
{
|
||||
BIGFOOT_NOT_OPTIMIZED_ONLY(std::ignore = Singleton<Log>::Instance().RegisterLogger(ENGINE_LOGGER);)
|
||||
}
|
||||
|
||||
BIGFOOT_NOT_OPTIMIZED_ONLY(Singleton<Log>::Lifetime m_loggerLifetime;)
|
||||
};
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(AssetFixture, Asset)
|
||||
{
|
||||
constexpr eastl::string_view name = "Hello";
|
||||
constexpr std::uint32_t version = 42;
|
||||
constexpr std::uint32_t health = 100;
|
||||
constexpr std::uint32_t mana = 50;
|
||||
|
||||
AssetA assetA;
|
||||
assetA.SetName(name);
|
||||
assetA.SetVersion(version);
|
||||
assetA.GetAsset().health = health;
|
||||
assetA.GetAsset().mana = mana;
|
||||
|
||||
const eastl::vector<std::byte> test = assetA.Pack();
|
||||
|
||||
AssetA assetB {test};
|
||||
|
||||
EXPECT_EQ(assetA.GetHeader().uuid, assetB.GetHeader().uuid);
|
||||
|
||||
EXPECT_EQ(assetA.GetHeader().type_id, AssetA::GetTypeID());
|
||||
EXPECT_EQ(assetA.GetHeader().type_id, assetB.GetHeader().type_id);
|
||||
|
||||
EXPECT_EQ(assetA.GetHeader().type_name, AssetA::GetTypeName());
|
||||
EXPECT_EQ(assetA.GetHeader().type_name, assetB.GetHeader().type_name);
|
||||
|
||||
EXPECT_EQ(assetA.GetHeader().name, name);
|
||||
EXPECT_EQ(assetA.GetHeader().name, assetB.GetHeader().name);
|
||||
|
||||
EXPECT_EQ(assetA.GetHeader().version, version);
|
||||
EXPECT_EQ(assetA.GetHeader().version, assetB.GetHeader().version);
|
||||
|
||||
EXPECT_EQ(assetA.GetHeader().dependencies, assetB.GetHeader().dependencies);
|
||||
|
||||
EXPECT_EQ(assetA.GetAsset().health, health);
|
||||
EXPECT_EQ(assetA.GetAsset().health, assetB.GetAsset().health);
|
||||
|
||||
EXPECT_EQ(assetA.GetAsset().mana, mana);
|
||||
EXPECT_EQ(assetA.GetAsset().mana, assetB.GetAsset().mana);
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(AssetFixture, Reflection)
|
||||
{
|
||||
[[maybe_unused]]
|
||||
const reflection::Schema* reflection = reflection::GetSchema(AssetA::ReflectionInfo().data());
|
||||
|
||||
for (const auto test: *reflection->root_table()->fields())
|
||||
{
|
||||
eastl::string typeName;
|
||||
|
||||
if (test->type()->base_type() == reflection::BaseType::Obj)
|
||||
{
|
||||
const reflection::Object* obj = reflection->objects()->Get(test->type()->index());
|
||||
typeName = obj->name()->c_str();
|
||||
}
|
||||
else if (test->type()->base_type() == reflection::BaseType::Vector &&
|
||||
test->type()->element() == reflection::BaseType::Obj)
|
||||
{
|
||||
const reflection::Object* obj = reflection->objects()->Get(test->type()->index());
|
||||
typeName = eastl::string("[") + obj->name()->c_str() + "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
typeName = reflection::EnumNameBaseType(test->type()->base_type());
|
||||
}
|
||||
|
||||
BIGFOOT_LOG_INFO(ENGINE_LOGGER, "{} {}", typeName, test->name()->c_str());
|
||||
}
|
||||
}
|
||||
} // namespace Bigfoot
|
||||
Reference in New Issue
Block a user