A Discrete-Event Network Simulator
API
type-traits-test-suite.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 University of Washington
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */
18 
19 #include "ns3/type-traits.h"
20 #include "ns3/test.h"
21 
22 using namespace ns3;
23 
25 {
26 public:
28  virtual ~TypeTraitsTestCase () {}
29 
30 private:
31  virtual void DoRun (void);
32 };
33 
35  : TestCase ("Check type traits")
36 {
37 }
38 
39 void
41 {
42  NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (void)>::IsPointerToMember, 1, "Check");
43  NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (void) const>::IsPointerToMember, 1, "Check");
44  NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (int)>::IsPointerToMember, 1, "Check");
45  NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (int) const>::IsPointerToMember, 1, "Check");
46  NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (void) const>::PointerToMemberTraits::nArgs, 0, "Check");
47  NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (int) const>::PointerToMemberTraits::nArgs, 1, "Check");
48 }
49 
51 {
52 public:
54 };
55 
57  : TestSuite ("type-traits", UNIT)
58 {
59  AddTestCase (new TypeTraitsTestCase, TestCase::QUICK);
60 }
61 
A suite of tests to run.
Definition: test.h:1333
static TypeTraitsTestSuite typeTraitsTestSuite
encapsulates test code
Definition: test.h:1147
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
Definition: test.cc:298
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Definition: test.h:161
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Inspect a type to deduce its features.
Definition: type-traits.h:37
virtual void DoRun(void)
Implementation to actually run this TestCase.