// Copyright (c) 2006, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // ---- // Author: Matt Austern #include "config.h" #include // for exit() #include #include #include #include using STL_NAMESPACE::string; using STL_NAMESPACE::vector; using STL_NAMESPACE::pair; #define ASSERT_TRUE(cond) do { \ if ( !(cond) ) { \ printf("Test failed: " #cond "\n"); \ exit(1); \ } \ } while (0) #define ASSERT_FALSE(cond) ASSERT_TRUE(!(cond)) // A user-defined POD type. struct A { int n_; }; // A user-defined non-POD type with a trivial copy constructor. class B { public: explicit B(int n) : n_(n) { } private: int n_; }; // Another user-defined non-POD type with a trivial copy constructor. // We will explicitly declare C to have a trivial copy constructor // by specializing has_trivial_copy. class C { public: explicit C(int n) : n_(n) { } private: int n_; }; _START_GOOGLE_NAMESPACE_ template<> struct has_trivial_copy : true_type { }; _END_GOOGLE_NAMESPACE_ // Another user-defined non-POD type with a trivial assignment operator. // We will explicitly declare C to have a trivial assignment operator // by specializing has_trivial_assign. class D { public: explicit D(int n) : n_(n) { } private: int n_; }; _START_GOOGLE_NAMESPACE_ template<> struct has_trivial_assign : true_type { }; _END_GOOGLE_NAMESPACE_ // Another user-defined non-POD type with a trivial constructor. // We will explicitly declare E to have a trivial constructor // by specializing has_trivial_constructor. class E { public: int n_; }; _START_GOOGLE_NAMESPACE_ template<> struct has_trivial_constructor : true_type { }; _END_GOOGLE_NAMESPACE_ // Another user-defined non-POD type with a trivial destructor. // We will explicitly declare E to have a trivial destructor // by specializing has_trivial_destructor. class F { public: explicit F(int n) : n_(n) { } private: int n_; }; _START_GOOGLE_NAMESPACE_ template<> struct has_trivial_destructor : true_type { }; _END_GOOGLE_NAMESPACE_ namespace { // type_equals_ is a template type comparator, similar to Loki IsSameType. // type_equals_::value is true iff "A" is the same type as "B". template struct type_equals_ : public GOOGLE_NAMESPACE::false_type { }; template struct type_equals_ : public GOOGLE_NAMESPACE::true_type { }; // A base class and a derived class that inherits from it, used for // testing conversion type traits. class Base { public: virtual ~Base() { } }; class Derived : public Base { }; // This assertion produces errors like "error: invalid use of // undefined type 'struct ::AssertTypesEq'" // when it fails. template struct AssertTypesEq; template struct AssertTypesEq {}; #define COMPILE_ASSERT_TYPES_EQ(T, U) AssertTypesEq() class TypeTraitsTest { public: static void TestIsInteger() { // Verify that is_integral is true for all integer types. ASSERT_TRUE(GOOGLE_NAMESPACE::is_integral::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_integral::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_integral::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_integral::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_integral::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_integral::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_integral::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_integral::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_integral::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_integral::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_integral::value); // Verify that is_integral is false for a few non-integer types. ASSERT_FALSE(GOOGLE_NAMESPACE::is_integral::value); ASSERT_FALSE(GOOGLE_NAMESPACE::is_integral::value); ASSERT_FALSE(GOOGLE_NAMESPACE::is_integral::value); ASSERT_FALSE(GOOGLE_NAMESPACE::is_integral::value); ASSERT_FALSE(GOOGLE_NAMESPACE::is_integral::value); ASSERT_FALSE((GOOGLE_NAMESPACE::is_integral >::value)); } static void TestIsFloating() { // Verify that is_floating_point is true for all floating-point types. ASSERT_TRUE(GOOGLE_NAMESPACE::is_floating_point::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_floating_point::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_floating_point::value); // Verify that is_floating_point is false for a few non-float types. ASSERT_FALSE(GOOGLE_NAMESPACE::is_floating_point::value); ASSERT_FALSE(GOOGLE_NAMESPACE::is_floating_point::value); ASSERT_FALSE(GOOGLE_NAMESPACE::is_floating_point::value); ASSERT_FALSE(GOOGLE_NAMESPACE::is_floating_point::value); ASSERT_FALSE(GOOGLE_NAMESPACE::is_floating_point::value); ASSERT_FALSE((GOOGLE_NAMESPACE::is_floating_point >::value)); } static void TestIsReference() { // Verifies that is_reference is true for all reference types. ASSERT_TRUE(GOOGLE_NAMESPACE::is_reference::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_reference::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_reference::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_reference::value); // Verifies that is_reference is false for all non-reference types. ASSERT_FALSE(GOOGLE_NAMESPACE::is_reference::value); ASSERT_FALSE(GOOGLE_NAMESPACE::is_reference::value); ASSERT_FALSE(GOOGLE_NAMESPACE::is_reference::value); ASSERT_FALSE(GOOGLE_NAMESPACE::is_reference::value); } static void TestIsPod() { // Verify that arithmetic types and pointers are marked as PODs. ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_TRUE(GOOGLE_NAMESPACE::is_pod::value); // Verify that some non-POD types are not marked as PODs. ASSERT_FALSE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_FALSE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_FALSE((GOOGLE_NAMESPACE::is_pod >::value)); ASSERT_FALSE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_FALSE(GOOGLE_NAMESPACE::is_pod::value); ASSERT_FALSE(GOOGLE_NAMESPACE::is_pod::value); } static void TestHasTrivialCopy() { // Verify that arithmetic types and pointers have trivial copy // constructors. ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); // Verify that pairs and arrays of such types have trivial // copy constructors. typedef int int10[10]; ASSERT_TRUE((GOOGLE_NAMESPACE::has_trivial_copy >::value)); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); // Verify that types without trivial copy constructors are // correctly marked as such. ASSERT_FALSE(GOOGLE_NAMESPACE::has_trivial_copy::value); ASSERT_FALSE(GOOGLE_NAMESPACE::has_trivial_copy >::value); // Verify that pairs of types without trivial copy constructors // are not marked as trivial. ASSERT_FALSE((GOOGLE_NAMESPACE::has_trivial_copy >::value)); ASSERT_FALSE((GOOGLE_NAMESPACE::has_trivial_copy >::value)); // Verify that C, which we have declared to have a trivial // copy constructor, is correctly marked as such. ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_copy::value); } static void TestHasTrivialConstructor() { // Verify that arithmetic types and pointers have trivial constructors. ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); // Verify that pairs and arrays of such types have trivial // constructors. typedef int int10[10]; ASSERT_TRUE((GOOGLE_NAMESPACE::has_trivial_constructor >::value)); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); // Verify that pairs of types without trivial constructors // are not marked as trivial. ASSERT_FALSE((GOOGLE_NAMESPACE::has_trivial_constructor >::value)); ASSERT_FALSE((GOOGLE_NAMESPACE::has_trivial_constructor >::value)); // Verify that types without trivial constructors are // correctly marked as such. ASSERT_FALSE(GOOGLE_NAMESPACE::has_trivial_constructor::value); ASSERT_FALSE(GOOGLE_NAMESPACE::has_trivial_constructor >::value); // Verify that E, which we have declared to have a trivial // constructor, is correctly marked as such. ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_constructor::value); } static void TestHasTrivialAssign() { // Verify that arithmetic types and pointers have trivial assignment // operators. ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); // Verify that pairs and arrays of such types have trivial // assignment operators. typedef int int10[10]; ASSERT_TRUE((GOOGLE_NAMESPACE::has_trivial_assign >::value)); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); // Verify that pairs of types without trivial assignment operators // are not marked as trivial. ASSERT_FALSE((GOOGLE_NAMESPACE::has_trivial_assign >::value)); ASSERT_FALSE((GOOGLE_NAMESPACE::has_trivial_assign >::value)); // Verify that types without trivial assignment operators are // correctly marked as such. ASSERT_FALSE(GOOGLE_NAMESPACE::has_trivial_assign::value); ASSERT_FALSE(GOOGLE_NAMESPACE::has_trivial_assign >::value); // Verify that D, which we have declared to have a trivial // assignment operator, is correctly marked as such. ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_assign::value); } static void TestHasTrivialDestructor() { // Verify that arithmetic types and pointers have trivial destructors. ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); // Verify that pairs and arrays of such types have trivial // destructors. typedef int int10[10]; ASSERT_TRUE((GOOGLE_NAMESPACE::has_trivial_destructor >::value)); ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); // Verify that pairs of types without trivial destructors // are not marked as trivial. ASSERT_FALSE((GOOGLE_NAMESPACE::has_trivial_destructor >::value)); ASSERT_FALSE((GOOGLE_NAMESPACE::has_trivial_destructor >::value)); // Verify that types without trivial destructors are // correctly marked as such. ASSERT_FALSE(GOOGLE_NAMESPACE::has_trivial_destructor::value); ASSERT_FALSE(GOOGLE_NAMESPACE::has_trivial_destructor >::value); // Verify that F, which we have declared to have a trivial // destructor, is correctly marked as such. ASSERT_TRUE(GOOGLE_NAMESPACE::has_trivial_destructor::value); } // Tests remove_pointer. static void TestRemovePointer() { COMPILE_ASSERT_TYPES_EQ(int, GOOGLE_NAMESPACE::remove_pointer::type); COMPILE_ASSERT_TYPES_EQ(int, GOOGLE_NAMESPACE::remove_pointer::type); COMPILE_ASSERT_TYPES_EQ(const int, GOOGLE_NAMESPACE::remove_pointer::type); COMPILE_ASSERT_TYPES_EQ(int, GOOGLE_NAMESPACE::remove_pointer::type); COMPILE_ASSERT_TYPES_EQ(int, GOOGLE_NAMESPACE::remove_pointer::type); } static void TestRemoveConst() { COMPILE_ASSERT_TYPES_EQ(int, GOOGLE_NAMESPACE::remove_const::type); COMPILE_ASSERT_TYPES_EQ(int, GOOGLE_NAMESPACE::remove_const::type); COMPILE_ASSERT_TYPES_EQ(int *, GOOGLE_NAMESPACE::remove_const::type); // TR1 examples. COMPILE_ASSERT_TYPES_EQ(const int *, GOOGLE_NAMESPACE::remove_const::type); COMPILE_ASSERT_TYPES_EQ(volatile int, GOOGLE_NAMESPACE::remove_const::type); } static void TestRemoveVolatile() { COMPILE_ASSERT_TYPES_EQ(int, GOOGLE_NAMESPACE::remove_volatile::type); COMPILE_ASSERT_TYPES_EQ(int, GOOGLE_NAMESPACE::remove_volatile::type); COMPILE_ASSERT_TYPES_EQ(int *, GOOGLE_NAMESPACE::remove_volatile::type); // TR1 examples. COMPILE_ASSERT_TYPES_EQ(volatile int *, GOOGLE_NAMESPACE::remove_volatile::type); COMPILE_ASSERT_TYPES_EQ(const int, GOOGLE_NAMESPACE::remove_volatile::type); } static void TestRemoveReference() { COMPILE_ASSERT_TYPES_EQ(int, GOOGLE_NAMESPACE::remove_reference::type); COMPILE_ASSERT_TYPES_EQ(int, GOOGLE_NAMESPACE::remove_reference::type); COMPILE_ASSERT_TYPES_EQ(const int, GOOGLE_NAMESPACE::remove_reference::type); COMPILE_ASSERT_TYPES_EQ(int*, GOOGLE_NAMESPACE::remove_reference::type); } static void TestRemoveCV() { COMPILE_ASSERT_TYPES_EQ(int, GOOGLE_NAMESPACE::remove_cv::type); COMPILE_ASSERT_TYPES_EQ(int, GOOGLE_NAMESPACE::remove_cv::type); COMPILE_ASSERT_TYPES_EQ(int, GOOGLE_NAMESPACE::remove_cv::type); COMPILE_ASSERT_TYPES_EQ(int *, GOOGLE_NAMESPACE::remove_cv::type); // TR1 examples. COMPILE_ASSERT_TYPES_EQ(const volatile int *, GOOGLE_NAMESPACE::remove_cv::type); COMPILE_ASSERT_TYPES_EQ(int, GOOGLE_NAMESPACE::remove_cv::type); } static void TestIsSame() { typedef int int32; typedef long int64; ASSERT_TRUE((GOOGLE_NAMESPACE::is_same::value)); ASSERT_FALSE((GOOGLE_NAMESPACE::is_same::value)); ASSERT_FALSE((GOOGLE_NAMESPACE::is_same::value)); ASSERT_FALSE((GOOGLE_NAMESPACE::is_same::value)); ASSERT_TRUE((GOOGLE_NAMESPACE::is_same::value)); ASSERT_FALSE((GOOGLE_NAMESPACE::is_same::value)); ASSERT_FALSE((GOOGLE_NAMESPACE::is_same::value)); ASSERT_TRUE((GOOGLE_NAMESPACE::is_same::value)); ASSERT_TRUE((GOOGLE_NAMESPACE::is_same::value)); ASSERT_FALSE((GOOGLE_NAMESPACE::is_same::value)); ASSERT_FALSE((GOOGLE_NAMESPACE::is_same::value)); ASSERT_FALSE((GOOGLE_NAMESPACE::is_same::value)); ASSERT_FALSE((GOOGLE_NAMESPACE::is_same::value)); ASSERT_TRUE((GOOGLE_NAMESPACE::is_same::value)); ASSERT_TRUE((GOOGLE_NAMESPACE::is_same::value)); ASSERT_FALSE((GOOGLE_NAMESPACE::is_same::value)); ASSERT_FALSE((GOOGLE_NAMESPACE::is_same::value)); } }; // end class TypeTraitsTest } // end anonymous namespace int main(int /*argc*/, char ** /*argv*/) { TypeTraitsTest::TestIsInteger(); TypeTraitsTest::TestIsFloating(); TypeTraitsTest::TestIsReference(); TypeTraitsTest::TestIsPod(); TypeTraitsTest::TestHasTrivialCopy(); TypeTraitsTest::TestHasTrivialConstructor(); TypeTraitsTest::TestHasTrivialAssign(); TypeTraitsTest::TestHasTrivialDestructor(); TypeTraitsTest::TestRemovePointer(); TypeTraitsTest::TestRemoveConst(); TypeTraitsTest::TestRemoveVolatile(); TypeTraitsTest::TestRemoveReference(); TypeTraitsTest::TestRemoveCV(); TypeTraitsTest::TestIsSame(); printf("PASS\n"); return 0; }