Files
Bin2CPP/Bin2CPP/Tests/Bin2CPPLib/Singleton.cpp
Romain BOULLARD 9b6ab354f3
All checks were successful
Bigfoot / Build & Test Debug (push) Successful in 49s
Bigfoot / Build & Test RelWithDebInfo (push) Successful in 1m1s
Bigfoot / Clang Format Checks (push) Successful in 9s
Bigfoot / Build & Test Release (push) Successful in 34s
Formatting
2026-02-21 17:08:44 +01:00

40 lines
1.1 KiB
C++

/*********************************************************************
* \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