Sanitizers
Some checks failed
Bigfoot / Build & Test Debug (push) Successful in 59s
Bigfoot / Build & Test RelWithDebInfo (push) Successful in 1m10s
Bigfoot / Clang Format Checks (push) Failing after 10s
Bigfoot / Build & Test Release (push) Successful in 41s

This commit is contained in:
2026-02-20 21:01:49 +01:00
parent f0fca19046
commit 7ecb7ebc76
3 changed files with 88 additions and 16 deletions

View File

@@ -1,39 +1,73 @@
/*********************************************************************
* \file Singleton.cpp
* \file Log.cpp
*
* \author Romain BOULLARD
* \date February 2026
*********************************************************************/
#include <Singleton.hpp>
#include <Log.hpp>
#include <gtest/gtest.h>
namespace Bin2CPP
{
class SingletonFixture: public ::testing::Test
class LogFixture: public ::testing::Test
{
protected:
Singleton<std::uint8_t>::Lifetime m_lifetime{8};
protected:
Log m_log;
};
/****************************************************************************************/
TEST_F(SingletonFixture, HasInstance_ShouldReturnTrueIfSingletonIsInitialized)
TEST_F(LogFixture, GetLogger_ShouldReturnTheLogger)
{
EXPECT_TRUE(Singleton<std::uint8_t>::HasInstance());
EXPECT_TRUE(m_log.GetLogger());
}
/****************************************************************************************/
TEST_F(SingletonFixture, HasInstance_ShouldReturnFaleIfSingletonIsNotInitialized)
TEST_F(LogFixture, LogDebug)
{
EXPECT_FALSE(Singleton<std::uint32_t>::HasInstance());
Singleton<Log>::Lifetime singletonLifetime;
BIN2CPP_LOG_DEBUG("Hello");
}
/****************************************************************************************/
TEST_F(SingletonFixture, Instance_ShouldReturnTheInstance)
TEST_F(LogFixture, LogTrace)
{
EXPECT_EQ(Singleton<std::uint8_t>::Instance(), 8);
Singleton<Log>::Lifetime singletonLifetime;
BIN2CPP_LOG_TRACE("Hello");
}
/****************************************************************************************/
TEST_F(LogFixture, LogInfo)
{
Singleton<Log>::Lifetime singletonLifetime;
BIN2CPP_LOG_INFO("Hello");
}
/****************************************************************************************/
TEST_F(LogFixture, LogWarn)
{
Singleton<Log>::Lifetime singletonLifetime;
BIN2CPP_LOG_WARN("Hello");
}
/****************************************************************************************/
TEST_F(LogFixture, LogError)
{
Singleton<Log>::Lifetime singletonLifetime;
BIN2CPP_LOG_ERROR("Hello");
}
/****************************************************************************************/
TEST_F(LogFixture, LogFatal)
{
Singleton<Log>::Lifetime singletonLifetime;
BIN2CPP_LOG_FATAL("Hello");
}
} // namespace Bin2CPP