Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 44s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 29s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 46s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 30s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m21s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 1m3s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m25s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 1m8s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 1m9s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m34s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 1m13s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 37s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 28s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 57s
Bigfoot / Sonarqube (push) Successful in 6m0s
sonarqube ERROR
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 49s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 30s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 52s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 36s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m23s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 44s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 59s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 51s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m5s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 56s
Bigfoot / Clang Format Checks (push) Successful in 13s
Bigfoot / Sonarqube (pull_request) Failing after 5m14s
Implementing an asset management system BigFile is a sqlite database, for toolmode Sasquatch is a custom binary file, for gamemode Assets are built from flatbuffers References allow to get an Asset, from an UUID, from anywhere in the code HardReference refcount the asset and allow automatic removal Reviewed-on: #1 Co-authored-by: Romain BOULLARD <romain.boullard@protonmail.com>
131 lines
3.9 KiB
C++
131 lines
3.9 KiB
C++
/*********************************************************************
|
|
* \file EASTLFormatters.cpp
|
|
*
|
|
* \author Romain BOULLARD
|
|
* \date August 2026
|
|
*********************************************************************/
|
|
#include <Utils/Log/EASTLFormatters.hpp>
|
|
|
|
#include <Utils/Log/LogMacros.hpp>
|
|
#include <Utils/Singleton.hpp>
|
|
|
|
#include <UtilsTests/UtilsTestsLogger_generated.hpp>
|
|
|
|
#include <EASTL/string.h>
|
|
#include <EASTL/string_view.h>
|
|
#include <EASTL/vector.h>
|
|
#include <fmt/format.h>
|
|
#include <gmock/gmock.h>
|
|
#include <gtest/gtest.h>
|
|
|
|
#include <fstream>
|
|
#include <sstream>
|
|
#include <string>
|
|
|
|
namespace Bigfoot
|
|
{
|
|
class EASTLFormattersFixture: public ::testing::Test
|
|
{
|
|
};
|
|
|
|
/****************************************************************************************/
|
|
TEST_F(EASTLFormattersFixture, FormatsEastlString)
|
|
{
|
|
const eastl::string value = "Hello";
|
|
EXPECT_EQ(fmt::format("{}", value), "Hello");
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(EASTLFormattersFixture, FormatsEastlStringView)
|
|
{
|
|
const eastl::string_view value = "Hello";
|
|
EXPECT_EQ(fmt::format("{}", value), "Hello");
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(EASTLFormattersFixture, FormatsEmptyVectorAsEmptyBrackets)
|
|
{
|
|
const eastl::vector<int> value;
|
|
EXPECT_EQ(fmt::format("{}", value), "[]");
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(EASTLFormattersFixture, FormatsSingleElementVectorWithoutASeparator)
|
|
{
|
|
const eastl::vector<int> value {42};
|
|
EXPECT_EQ(fmt::format("{}", value), "[42]");
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(EASTLFormattersFixture, FormatsVectorOfIntsCommaSeparated)
|
|
{
|
|
const eastl::vector<int> value {1, 2, 3};
|
|
EXPECT_EQ(fmt::format("{}", value), "[1, 2, 3]");
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(EASTLFormattersFixture, FormatsVectorOfEastlStrings)
|
|
{
|
|
const eastl::vector<eastl::string> value {"a", "b"};
|
|
EXPECT_EQ(fmt::format("{}", value), "[a, b]");
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(EASTLFormattersFixture, FormatsNestedVectors)
|
|
{
|
|
const eastl::vector<eastl::vector<int>> value {{1, 2}, {3}};
|
|
EXPECT_EQ(fmt::format("{}", value), "[[1, 2], [3]]");
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
#ifdef BIGFOOT_NOT_OPTIMIZED
|
|
class EASTLFormattersLogFixture: public ::testing::Test
|
|
{
|
|
protected:
|
|
static std::string ReadFileSinkContent()
|
|
{
|
|
Singleton<Log>::GetInstance().Flush();
|
|
|
|
std::ifstream file {std::string {Log::FILE_SINK_PATH.data()}};
|
|
std::stringstream buffer;
|
|
buffer << file.rdbuf();
|
|
return buffer.str();
|
|
}
|
|
};
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(EASTLFormattersLogFixture, LogsEastlStringArgument)
|
|
{
|
|
const eastl::string value = "Hello EASTL string";
|
|
BIGFOOT_LOG_INFO(UTILSTESTS_LOGGER, "{}", value);
|
|
EXPECT_THAT(ReadFileSinkContent(), ::testing::HasSubstr("Hello EASTL string"));
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(EASTLFormattersLogFixture, LogsEmptyVectorArgument)
|
|
{
|
|
const eastl::vector<int> value;
|
|
BIGFOOT_LOG_INFO(UTILSTESTS_LOGGER, "{}", value);
|
|
EXPECT_THAT(ReadFileSinkContent(), ::testing::HasSubstr("[]"));
|
|
}
|
|
|
|
/****************************************************************************************/
|
|
|
|
TEST_F(EASTLFormattersLogFixture, LogsVectorArgumentWithCommaSeparators)
|
|
{
|
|
const eastl::vector<eastl::string> value {"a", "b", "c"};
|
|
BIGFOOT_LOG_INFO(UTILSTESTS_LOGGER, "{}", value);
|
|
EXPECT_THAT(ReadFileSinkContent(), ::testing::HasSubstr("[a, b, c]"));
|
|
}
|
|
#endif
|
|
} // namespace Bigfoot
|