A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
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
/*
2
* Copyright (c) 2009 University of Washington
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*/
17
18
#include "ns3/test.h"
19
#include "ns3/type-traits.h"
20
29
namespace
ns3
30
{
31
32
namespace
tests
33
{
34
39
class
TypeTraitsTestCase
:
public
TestCase
40
{
41
public
:
43
TypeTraitsTestCase
();
44
46
~TypeTraitsTestCase
()
override
47
{
48
}
49
50
private
:
51
void
DoRun
()
override
;
52
};
53
54
TypeTraitsTestCase::TypeTraitsTestCase
()
55
:
TestCase
(
"Check type traits"
)
56
{
57
}
58
59
void
60
TypeTraitsTestCase::DoRun
()
61
{
62
NS_TEST_ASSERT_MSG_EQ
(
TypeTraits
<
void
(
TypeTraitsTestCase
::*)()>::IsPointerToMember,
63
1,
64
"Check pointer to member function ()"
);
65
NS_TEST_ASSERT_MSG_EQ
(
TypeTraits
<
void
(
TypeTraitsTestCase
::*)()
const
>::IsPointerToMember,
66
1,
67
"Check pointer to member function () const"
);
68
NS_TEST_ASSERT_MSG_EQ
(
TypeTraits
<
void
(
TypeTraitsTestCase
::*)(
int
)>::IsPointerToMember,
69
1,
70
"Check pointer to member function (int)"
);
71
NS_TEST_ASSERT_MSG_EQ
(
TypeTraits
<
void
(
TypeTraitsTestCase
::*)(
int
)
const
>::IsPointerToMember,
72
1,
73
"Check pointer to member function (int) const"
);
74
NS_TEST_ASSERT_MSG_EQ
(
75
TypeTraits
<
void
(
TypeTraitsTestCase
::*)()
const
>::PointerToMemberTraits::nArgs,
76
0,
77
"Check number of arguments for pointer to member function () const"
);
78
NS_TEST_ASSERT_MSG_EQ
(
79
TypeTraits
<
void
(
TypeTraitsTestCase
::*)(
int
)
const
>::PointerToMemberTraits::nArgs,
80
1,
81
"Check number of arguments for pointer to member function (int) const"
);
82
}
83
88
class
TypeTraitsTestSuite
:
public
TestSuite
89
{
90
public
:
92
TypeTraitsTestSuite
();
93
};
94
95
TypeTraitsTestSuite::TypeTraitsTestSuite
()
96
:
TestSuite
(
"type-traits"
)
97
{
98
AddTestCase
(
new
TypeTraitsTestCase
);
99
}
100
105
static
TypeTraitsTestSuite
g_typeTraitsTestSuite
;
106
107
}
// namespace tests
108
109
}
// namespace ns3
ns3::TestCase
encapsulates test code
Definition:
test.h:1060
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition:
test.cc:301
ns3::TestSuite
A suite of tests to run.
Definition:
test.h:1256
ns3::tests::TypeTraitsTestCase
Type traits test.
Definition:
type-traits-test-suite.cc:40
ns3::tests::TypeTraitsTestCase::~TypeTraitsTestCase
~TypeTraitsTestCase() override
Destructor.
Definition:
type-traits-test-suite.cc:46
ns3::tests::TypeTraitsTestCase::DoRun
void DoRun() override
Implementation to actually run this TestCase.
Definition:
type-traits-test-suite.cc:60
ns3::tests::TypeTraitsTestCase::TypeTraitsTestCase
TypeTraitsTestCase()
Constructor.
Definition:
type-traits-test-suite.cc:54
ns3::tests::TypeTraitsTestSuite
Type traits test suite.
Definition:
type-traits-test-suite.cc:89
ns3::tests::TypeTraitsTestSuite::TypeTraitsTestSuite
TypeTraitsTestSuite()
Constructor.
Definition:
type-traits-test-suite.cc:95
ns3::tests::g_typeTraitsTestSuite
static TypeTraitsTestSuite g_typeTraitsTestSuite
TypeTraitsTestSuite instance variable.
Definition:
type-traits-test-suite.cc:105
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:144
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::TypeTraits
Inspect a type to deduce its features.
Definition:
type-traits.h:40
src
core
test
type-traits-test-suite.cc
Generated on Sun Mar 3 2024 17:10:56 for ns-3 by
1.9.1