Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
ahSingleton_test.cc File Reference

Unit tests for ahSingleton.H. More...

#include <gtest/gtest.h>
#include <ahSingleton.H>
#include <atomic>
#include <thread>
#include <type_traits>
#include <vector>
Include dependency graph for ahSingleton_test.cc:

Go to the source code of this file.

Functions

 TEST (AhSingleton, SingletonGetInstanceReturnsSameObject)
 
 TEST (AhSingleton, MakeSingletonReturnsSameObject)
 
 TEST (AhSingleton, MakeSingletonReturnsNonConstReferenceAndIsMutable)
 
 TEST (AhSingleton, CopyAndMoveAreDisabled)
 
 TEST (AhSingleton, GetInstanceIsNoexcept)
 
 TEST (AhSingleton, ThreadSafeInitializationMeyersSingleton)
 
int main (int argc, char **argv)
 

Detailed Description

Unit tests for ahSingleton.H.

Tests cover:

  • Single instance guarantee (same address on multiple calls)
  • Macro-based singleton functionality
  • Mutability of singleton state
  • Copy/move operations are deleted
  • Thread-safe initialization (concurrent access)
  • noexcept guarantee

Definition in file ahSingleton_test.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 157 of file ahSingleton_test.cc.

◆ TEST() [1/6]

TEST ( AhSingleton  ,
CopyAndMoveAreDisabled   
)

Definition at line 101 of file ahSingleton_test.cc.

◆ TEST() [2/6]

TEST ( AhSingleton  ,
GetInstanceIsNoexcept   
)

Definition at line 114 of file ahSingleton_test.cc.

References Singleton::get_instance().

◆ TEST() [3/6]

TEST ( AhSingleton  ,
MakeSingletonReturnsNonConstReferenceAndIsMutable   
)

Definition at line 94 of file ahSingleton_test.cc.

◆ TEST() [4/6]

TEST ( AhSingleton  ,
MakeSingletonReturnsSameObject   
)

Definition at line 87 of file ahSingleton_test.cc.

◆ TEST() [5/6]

TEST ( AhSingleton  ,
SingletonGetInstanceReturnsSameObject   
)

Definition at line 80 of file ahSingleton_test.cc.

References Singleton::get_instance().

◆ TEST() [6/6]

TEST ( AhSingleton  ,
ThreadSafeInitializationMeyersSingleton   
)

Definition at line 121 of file ahSingleton_test.cc.