Files
Bigfoot/Bigfoot/Tests/Utils/Log/LogMacros.cpp
T
rboullard 8392245b10
Bigfoot / Sonarqube (push) Skipped
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 47s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 28s
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 34s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m16s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 42s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 26s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 45s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 28s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m12s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 59s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m17s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 59s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 1m0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m24s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 1m6s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 35s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 25s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 53s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 42s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 46s
sonarqube ERROR
Bigfoot / Sonarqube (pull_request) Failing after 4m45s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 52s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 59s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 49s
Bigfoot / Clang Format Checks (push) Successful in 9s
Reduce back and forth between std and eastl
2026-09-01 15:05:25 +02:00

87 lines
2.4 KiB
C++

/*********************************************************************
* \file LogMacros.cpp
*
* \author Romain BOULLARD
* \date May 2026
*********************************************************************/
#include <Utils/Log/LogMacros.hpp>
#include <Utils/Singleton.hpp>
#include <UtilsTests/UtilsTestsLogger_generated.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <fstream>
#include <sstream>
#include <string>
namespace Bigfoot
{
class LogMacrosFixture: public ::testing::Test
{
protected:
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(LogMacrosFixture, LogDebug)
{
BIGFOOT_LOG_DEBUG(UTILSTESTS_LOGGER, "Hello Debug");
EXPECT_THAT(ReadFileSinkContent(), ::testing::HasSubstr("Hello Debug"));
}
/****************************************************************************************/
TEST_F(LogMacrosFixture, LogTrace)
{
BIGFOOT_LOG_TRACE(UTILSTESTS_LOGGER, "Hello Trace");
EXPECT_THAT(ReadFileSinkContent(), ::testing::HasSubstr("Hello Trace"));
}
/****************************************************************************************/
TEST_F(LogMacrosFixture, LogInfo)
{
BIGFOOT_LOG_INFO(UTILSTESTS_LOGGER, "Hello Info");
EXPECT_THAT(ReadFileSinkContent(), ::testing::HasSubstr("Hello Info"));
}
/****************************************************************************************/
TEST_F(LogMacrosFixture, LogWarn)
{
BIGFOOT_LOG_WARN(UTILSTESTS_LOGGER, "Hello Warn");
EXPECT_THAT(ReadFileSinkContent(), ::testing::HasSubstr("Hello Warn"));
}
/****************************************************************************************/
TEST_F(LogMacrosFixture, LogError)
{
BIGFOOT_LOG_ERROR(UTILSTESTS_LOGGER, "Hello Error");
EXPECT_THAT(ReadFileSinkContent(), ::testing::HasSubstr("Hello Error"));
}
/****************************************************************************************/
TEST_F(LogMacrosFixture, LogFatal)
{
BIGFOOT_LOG_FATAL(UTILSTESTS_LOGGER, "Hello Fatal");
EXPECT_THAT(ReadFileSinkContent(), ::testing::HasSubstr("Hello Fatal"));
}
} // namespace Bigfoot
#endif