src/core/type-traits-test.cc
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sat, 04 Jul 2009 08:15:48 +0200
changeset 4654 2eaebe77d66b
permissions -rw-r--r--
Added tag ns-3.5 for changeset c975274c9707
     1 #include "type-traits.h"
     2 #include "test.h"
     3 
     4 #ifdef RUN_SELF_TESTS
     5 
     6 namespace ns3 {
     7 
     8 class TypeTraitsTest : public Test
     9 {
    10 public:
    11   TypeTraitsTest ();
    12   virtual bool RunTests (void);
    13 };
    14 
    15 TypeTraitsTest::TypeTraitsTest ()
    16   : Test ("TypeTraits")
    17 {}
    18 bool 
    19 TypeTraitsTest::RunTests (void)
    20 {
    21   bool result = true;
    22 
    23   //TypeTraits<int &>::ReferencedType ir;
    24   //TypeTraits<const int>::NonConstType uci;
    25   NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (void)>::IsPointerToMember, 1);
    26   NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (void) const>::IsPointerToMember, 1);
    27   NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (int)>::IsPointerToMember, 1);
    28   NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (int) const>::IsPointerToMember, 1);
    29   NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (void) const>::PointerToMemberTraits::nArgs, 0);
    30   NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (int) const>::PointerToMemberTraits::nArgs, 1);
    31 
    32   return result;
    33 }
    34 
    35 static TypeTraitsTest g_typeTraitsTest;
    36 
    37 } // namespace ns3
    38 
    39 #endif /* RUN_SELF_TESTS */
    40