A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
type-traits-test-suite.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 University of Washington
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*/
6
7
#include "ns3/test.h"
8
#include "ns3/type-traits.h"
9
#include "ns3/warnings.h"
10
11
/**
12
* \file
13
* \ingroup core-tests
14
* \ingroup object
15
* \ingroup object-tests
16
* TypeTraits test suite.
17
*/
18
19
namespace
ns3
20
{
21
22
namespace
tests
23
{
24
25
/**
26
* \ingroup object-tests
27
* Type traits test
28
*/
29
class
TypeTraitsTestCase
:
public
TestCase
30
{
31
public
:
32
/** Constructor. */
33
TypeTraitsTestCase
();
34
35
/** Destructor. */
36
~TypeTraitsTestCase
()
override
37
{
38
}
39
40
private
:
41
void
DoRun
()
override
;
42
};
43
44
TypeTraitsTestCase::TypeTraitsTestCase
()
45
:
TestCase
(
"Check type traits"
)
46
{
47
}
48
49
void
50
TypeTraitsTestCase::DoRun
()
51
{
52
// NS_DEPRECATED_3_43
53
// The TypeTraits struct has been deprecated in ns-3.43.
54
// While the struct isn't removed, the deprecation warnings must be silenced.
55
// Once the struct is removed, this test suite should be deleted.
56
NS_WARNING_PUSH_DEPRECATED
;
57
58
NS_TEST_ASSERT_MSG_EQ
(
TypeTraits
<
void
(
TypeTraitsTestCase
::*)()>::IsPointerToMember,
59
1,
60
"Check pointer to member function ()"
);
61
NS_TEST_ASSERT_MSG_EQ
(
TypeTraits
<
void
(
TypeTraitsTestCase
::*)()
const
>::IsPointerToMember,
62
1,
63
"Check pointer to member function () const"
);
64
NS_TEST_ASSERT_MSG_EQ
(
TypeTraits
<
void
(
TypeTraitsTestCase
::*)(
int
)>::IsPointerToMember,
65
1,
66
"Check pointer to member function (int)"
);
67
NS_TEST_ASSERT_MSG_EQ
(
TypeTraits
<
void
(
TypeTraitsTestCase
::*)(
int
)
const
>::IsPointerToMember,
68
1,
69
"Check pointer to member function (int) const"
);
70
NS_TEST_ASSERT_MSG_EQ
(
71
TypeTraits
<
void
(
TypeTraitsTestCase
::*)()
const
>::PointerToMemberTraits::nArgs,
72
0,
73
"Check number of arguments for pointer to member function () const"
);
74
NS_TEST_ASSERT_MSG_EQ
(
75
TypeTraits
<
void
(
TypeTraitsTestCase
::*)(
int
)
const
>::PointerToMemberTraits::nArgs,
76
1,
77
"Check number of arguments for pointer to member function (int) const"
);
78
79
NS_WARNING_POP
;
80
}
81
82
/**
83
* \ingroup object-tests
84
* Type traits test suite
85
*/
86
class
TypeTraitsTestSuite
:
public
TestSuite
87
{
88
public
:
89
/** Constructor. */
90
TypeTraitsTestSuite
();
91
};
92
93
TypeTraitsTestSuite::TypeTraitsTestSuite
()
94
:
TestSuite
(
"type-traits"
)
95
{
96
AddTestCase
(
new
TypeTraitsTestCase
);
97
}
98
99
/**
100
* \ingroup object-tests
101
* TypeTraitsTestSuite instance variable.
102
*/
103
static
TypeTraitsTestSuite
g_typeTraitsTestSuite
;
104
105
}
// namespace tests
106
107
}
// namespace ns3
ns3::TestCase
encapsulates test code
Definition
test.h:1050
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition
test.cc:292
ns3::TestSuite
A suite of tests to run.
Definition
test.h:1267
ns3::tests::TypeTraitsTestCase
Type traits test.
Definition
type-traits-test-suite.cc:30
ns3::tests::TypeTraitsTestCase::~TypeTraitsTestCase
~TypeTraitsTestCase() override
Destructor.
Definition
type-traits-test-suite.cc:36
ns3::tests::TypeTraitsTestCase::DoRun
void DoRun() override
Implementation to actually run this TestCase.
Definition
type-traits-test-suite.cc:50
ns3::tests::TypeTraitsTestCase::TypeTraitsTestCase
TypeTraitsTestCase()
Constructor.
Definition
type-traits-test-suite.cc:44
ns3::tests::TypeTraitsTestSuite
Type traits test suite.
Definition
type-traits-test-suite.cc:87
ns3::tests::TypeTraitsTestSuite::TypeTraitsTestSuite
TypeTraitsTestSuite()
Constructor.
Definition
type-traits-test-suite.cc:93
ns3::tests::g_typeTraitsTestSuite
static TypeTraitsTestSuite g_typeTraitsTestSuite
TypeTraitsTestSuite instance variable.
Definition
type-traits-test-suite.cc:103
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:134
NS_WARNING_POP
#define NS_WARNING_POP
Pops the diagnostic warning list from the stack, restoring it to the previous state.
Definition
warnings.h:102
NS_WARNING_PUSH_DEPRECATED
#define NS_WARNING_PUSH_DEPRECATED
Save the current warning list and disables the ones about deprecated functions and classes.
Definition
warnings.h:114
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:30
src
core
test
type-traits-test-suite.cc
Generated on Fri Nov 8 2024 13:59:00 for ns-3 by
1.11.0