Sanitizers
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,3 +1,39 @@
|
||||
//
|
||||
// Created by romain on 16/02/2026.
|
||||
//
|
||||
/*********************************************************************
|
||||
* \file Singleton.cpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date February 2026
|
||||
*********************************************************************/
|
||||
#include <Singleton.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
namespace Bin2CPP
|
||||
{
|
||||
class SingletonFixture: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
Singleton<std::uint8_t>::Lifetime m_lifetime{8};
|
||||
};
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(SingletonFixture, HasInstance_ShouldReturnTrueIfSingletonIsInitialized)
|
||||
{
|
||||
EXPECT_TRUE(Singleton<std::uint8_t>::HasInstance());
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(SingletonFixture, HasInstance_ShouldReturnFaleIfSingletonIsNotInitialized)
|
||||
{
|
||||
EXPECT_FALSE(Singleton<std::uint32_t>::HasInstance());
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(SingletonFixture, Instance_ShouldReturnTheInstance)
|
||||
{
|
||||
EXPECT_EQ(Singleton<std::uint8_t>::Instance(), 8);
|
||||
}
|
||||
} // namespace Bin2CPP
|
||||
|
||||
Reference in New Issue
Block a user