A Discrete-Event Network Simulator
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
19namespace ns3
20{
21
22namespace tests
23{
24
25/**
26 * @ingroup object-tests
27 * Type traits test
28 */
30{
31 public:
32 /** Constructor. */
34
35 /** Destructor. */
37 {
38 }
39
40 private:
41 void DoRun() override;
42};
43
45 : TestCase("Check type traits")
46{
47}
48
49void
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.
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");
71 TypeTraits<void (TypeTraitsTestCase::*)() const>::PointerToMemberTraits::nArgs,
72 0,
73 "Check number of arguments for pointer to member function () const");
75 TypeTraits<void (TypeTraitsTestCase::*)(int) const>::PointerToMemberTraits::nArgs,
76 1,
77 "Check number of arguments for pointer to member function (int) const");
78
80}
81
82/**
83 * @ingroup object-tests
84 * Type traits test suite
85 */
87{
88 public:
89 /** Constructor. */
91};
92
98
99/**
100 * @ingroup object-tests
101 * TypeTraitsTestSuite instance variable.
102 */
104
105} // namespace tests
106
107} // namespace ns3
encapsulates test code
Definition test.h:1050
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:292
A suite of tests to run.
Definition test.h:1267
void DoRun() override
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:134
#define NS_WARNING_POP
Pops the diagnostic warning list from the stack, restoring it to the previous state.
Definition warnings.h:102
#define NS_WARNING_PUSH_DEPRECATED
Save the current warning list and disables the ones about deprecated functions and classes.
Definition warnings.h:114
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Inspect a type to deduce its features.
Definition type-traits.h:30