proxygen
ColdClassTest.cpp File Reference
#include <folly/lang/ColdClass.h>
#include <folly/portability/GTest.h>
#include <type_traits>

Go to the source code of this file.

Functions

template<class TestClass >
static void validateInheritedClass ()
 
 TEST (ColdClassTest, publicInheritance)
 
 TEST (ColdClassTest, protectedInheritance)
 
 TEST (ColdClassTest, privateInheritance)
 

Function Documentation

TEST ( ColdClassTest  ,
publicInheritance   
)

Definition at line 43 of file ColdClassTest.cpp.

43  {
44  struct TestPublic : ColdClass {};
45  validateInheritedClass<TestPublic>();
46 }
TEST ( ColdClassTest  ,
protectedInheritance   
)

Definition at line 48 of file ColdClassTest.cpp.

48  {
49  // Same again, but protected inheritance. Should make no difference.
50  class TestProtected : protected ColdClass {};
51  validateInheritedClass<TestProtected>();
52 }
TEST ( ColdClassTest  ,
privateInheritance   
)

Definition at line 54 of file ColdClassTest.cpp.

54  {
55  // Same again, but private inheritance. Should make no difference.
56  class TestPrivate : ColdClass {};
57  validateInheritedClass<TestPrivate>();
58 }
template<class TestClass >
static void validateInheritedClass ( )
static

Definition at line 25 of file ColdClassTest.cpp.

References EXPECT_TRUE, and value.

25  {
26  // The only verifiable property of ColdClass is that it must not disrupt the
27  // default constructor/destructor, default copy/move constructors and default
28  // copy/move assignment operators when a class derives from it.
30 #if !defined(__GLIBCXX__) || __GNUC__ >= 5
35 #endif
41 }
static const char *const value
Definition: Conv.cpp:50
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859