A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
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
30
namespace
ns3
{
31
32
namespace
tests
{
33
34
39
class
TypeTraitsTestCase
:
public
TestCase
40
{
41
public
:
43
TypeTraitsTestCase
();
45
virtual
~TypeTraitsTestCase
()
46
{}
47
48
private
:
49
virtual
void
DoRun
(
void
);
50
};
51
52
TypeTraitsTestCase::TypeTraitsTestCase
(
void
)
53
:
TestCase
(
"Check type traits"
)
54
{}
55
56
void
57
TypeTraitsTestCase::DoRun
(
void
)
58
{
59
NS_TEST_ASSERT_MSG_EQ
60
(
TypeTraits
<
void
(
TypeTraitsTestCase
::*)(
void
)>::IsPointerToMember, 1,
61
"Check pointer to member function (void)"
);
62
NS_TEST_ASSERT_MSG_EQ
63
(
TypeTraits
<
void
(
TypeTraitsTestCase
::*)(
void
)
const
>::IsPointerToMember, 1,
64
"Check pointer to member function (void) const"
);
65
NS_TEST_ASSERT_MSG_EQ
66
(
TypeTraits
<
void
(
TypeTraitsTestCase
::*)(
int
)>::IsPointerToMember, 1,
67
"Check pointer to member function (int)"
);
68
NS_TEST_ASSERT_MSG_EQ
69
(
TypeTraits
<
void
(
TypeTraitsTestCase
::*)(
int
)
const
>::IsPointerToMember, 1,
70
"Check pointer to member function (int) const"
);
71
NS_TEST_ASSERT_MSG_EQ
72
(
TypeTraits
<
void
(
TypeTraitsTestCase
::*)(
void
)
const
>::PointerToMemberTraits::nArgs, 0,
73
"Check number of arguments for pointer to member function (void) const"
);
74
NS_TEST_ASSERT_MSG_EQ
75
(
TypeTraits
<
void
(
TypeTraitsTestCase
::*)(
int
)
const
>::PointerToMemberTraits::nArgs, 1,
76
"Check number of arguments for pointer to member function (int) const"
);
77
}
78
83
class
TypeTraitsTestSuite
:
public
TestSuite
84
{
85
public
:
87
TypeTraitsTestSuite
();
88
};
89
90
TypeTraitsTestSuite::TypeTraitsTestSuite
()
91
:
TestSuite
(
"type-traits"
)
92
{
93
AddTestCase
(
new
TypeTraitsTestCase
);
94
}
95
100
static
TypeTraitsTestSuite
g_typeTraitsTestSuite
;
101
102
103
}
// namespace tests
104
105
}
// namespace ns3
ns3::TestCase
encapsulates test code
Definition:
test.h:994
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition:
test.cc:299
ns3::TestSuite
A suite of tests to run.
Definition:
test.h:1188
ns3::tests::TypeTraitsTestCase
Type traits test.
Definition:
type-traits-test-suite.cc:40
ns3::tests::TypeTraitsTestCase::~TypeTraitsTestCase
virtual ~TypeTraitsTestCase()
Destructor.
Definition:
type-traits-test-suite.cc:45
ns3::tests::TypeTraitsTestCase::TypeTraitsTestCase
TypeTraitsTestCase()
Constructor.
Definition:
type-traits-test-suite.cc:52
ns3::tests::TypeTraitsTestCase::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition:
type-traits-test-suite.cc:57
ns3::tests::TypeTraitsTestSuite
Type traits test suite.
Definition:
type-traits-test-suite.cc:84
ns3::tests::TypeTraitsTestSuite::TypeTraitsTestSuite
TypeTraitsTestSuite()
Constructor.
Definition:
type-traits-test-suite.cc:90
ns3::tests::g_typeTraitsTestSuite
static TypeTraitsTestSuite g_typeTraitsTestSuite
TypeTraitsTestSuite instance variable.
Definition:
type-traits-test-suite.cc:100
NS_TEST_ASSERT_MSG_EQ
#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
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
test-ns3.tests
tests
Definition:
test-ns3.py:2134
ns3::TypeTraits
Inspect a type to deduce its features.
Definition:
type-traits.h:40
src
core
test
type-traits-test-suite.cc
Generated on Tue Feb 6 2024 19:21:17 for ns-3 by
1.9.1