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
30namespace ns3 {
31
32namespace tests {
33
34
40{
41public:
46 {}
47
48private:
49 virtual void DoRun (void);
50};
51
53 : TestCase ("Check type traits")
54{}
55
56void
58{
60 (TypeTraits<void (TypeTraitsTestCase::*)(void)>::IsPointerToMember, 1,
61 "Check pointer to member function (void)");
63 (TypeTraits<void (TypeTraitsTestCase::*)(void) const>::IsPointerToMember, 1,
64 "Check pointer to member function (void) const");
66 (TypeTraits<void (TypeTraitsTestCase::*)(int)>::IsPointerToMember, 1,
67 "Check pointer to member function (int)");
69 (TypeTraits<void (TypeTraitsTestCase::*)(int) const>::IsPointerToMember, 1,
70 "Check pointer to member function (int) const");
72 (TypeTraits<void (TypeTraitsTestCase::*)(void) const>::PointerToMemberTraits::nArgs, 0,
73 "Check number of arguments for pointer to member function (void) const");
75 (TypeTraits<void (TypeTraitsTestCase::*)(int) const>::PointerToMemberTraits::nArgs, 1,
76 "Check number of arguments for pointer to member function (int) const");
77}
78
84{
85public:
88};
89
91 : TestSuite ("type-traits")
92{
94}
95
101
102
103} // namespace tests
104
105} // namespace ns3
encapsulates test code
Definition: test.h:994
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
A suite of tests to run.
Definition: test.h:1188
virtual void DoRun(void)
Implementation to actually run this TestCase.
static TypeTraitsTestSuite g_typeTraitsTestSuite
TypeTraitsTestSuite instance variable.
#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:141
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Inspect a type to deduce its features.
Definition: type-traits.h:40