Utilities
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
/*********************************************************************
|
||||
* \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
|
||||
|
||||
3
Bin2CPP/Tests/Bin2CPPLib/Singleton.cpp
Normal file
3
Bin2CPP/Tests/Bin2CPPLib/Singleton.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
//
|
||||
// Created by romain on 16/02/2026.
|
||||
//
|
||||
Reference in New Issue
Block a user