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
mathieu@1678
     1
#include "type-traits.h"
mathieu@1678
     2
#include "test.h"
mathieu@1678
     3
mathieu@1678
     4
#ifdef RUN_SELF_TESTS
mathieu@1678
     5
mathieu@1678
     6
namespace ns3 {
mathieu@1678
     7
mathieu@1678
     8
class TypeTraitsTest : public Test
mathieu@1678
     9
{
mathieu@1678
    10
public:
mathieu@1678
    11
  TypeTraitsTest ();
mathieu@1678
    12
  virtual bool RunTests (void);
mathieu@1678
    13
};
mathieu@1678
    14
mathieu@1678
    15
TypeTraitsTest::TypeTraitsTest ()
mathieu@1678
    16
  : Test ("TypeTraits")
mathieu@1678
    17
{}
mathieu@1678
    18
bool 
mathieu@1678
    19
TypeTraitsTest::RunTests (void)
mathieu@1678
    20
{
mathieu@1678
    21
  bool result = true;
mathieu@1678
    22
mathieu@1678
    23
  //TypeTraits<int &>::ReferencedType ir;
mathieu@1678
    24
  //TypeTraits<const int>::NonConstType uci;
mathieu@1678
    25
  NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (void)>::IsPointerToMember, 1);
mathieu@1678
    26
  NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (void) const>::IsPointerToMember, 1);
mathieu@1678
    27
  NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (int)>::IsPointerToMember, 1);
mathieu@1678
    28
  NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (int) const>::IsPointerToMember, 1);
mathieu@1678
    29
  NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (void) const>::PointerToMemberTraits::nArgs, 0);
mathieu@1678
    30
  NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (int) const>::PointerToMemberTraits::nArgs, 1);
mathieu@1678
    31
mathieu@1678
    32
  return result;
mathieu@1678
    33
}
mathieu@1678
    34
mathieu@1678
    35
static TypeTraitsTest g_typeTraitsTest;
mathieu@1678
    36
mathieu@1678
    37
} // namespace ns3
mathieu@1678
    38
mathieu@1678
    39
#endif /* RUN_SELF_TESTS */
mathieu@1678
    40