You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
555 B
36 lines
555 B
#include <cxxtest/TestSuite.h>
|
|
|
|
#define private public // need to reach Singleton's private m_instance
|
|
|
|
#include "Common.hpp"
|
|
#include "Fixture.hpp"
|
|
#include "Singleton_call_once.hpp"
|
|
|
|
|
|
class TestSingletonCallOnceSuite : public CxxTest::TestSuite
|
|
{
|
|
|
|
private:
|
|
|
|
class BasicSingleton : public Singleton_call_once<BasicSingleton>
|
|
{
|
|
public:
|
|
int getSeven()
|
|
{
|
|
TRACE;
|
|
return 7;
|
|
}
|
|
};
|
|
|
|
public:
|
|
|
|
void testBasic( void )
|
|
{
|
|
TEST_HEADER;
|
|
|
|
TS_ASSERT_EQUALS( BasicSingleton::getInstance()->getSeven(), 7 );
|
|
}
|
|
|
|
|
|
};
|