24#include <ns3/double.h>
25#include <ns3/integer.h>
26#include <ns3/string.h>
28#include <ns3/object.h>
29#include <ns3/type-id.h>
94 .AddAttribute (
"StringPair",
"Pair: string, string",
98 .AddAttribute (
"DoubleIntPair",
"Pair: double int",
102 MakePairChecker<DoubleValue, IntegerValue> (MakeDoubleChecker<double> (), MakeIntegerChecker<int> ()))
134 virtual void DoRun ();
138 :
TestCase (
"test instantiation, initialization, access")
147 std::pair<const int, double> ref = {1, 2.4};
151 std::pair<const int, double> rv = ac.
Get ();
156 std::pair<const std::string, double> ref = {
"hello", 3.14};
160 std::pair<const std::string, double> rv = ac.
Get ();
180 :
TestCase (
"test setting through attribute interface")
186 auto p = CreateObject <PairObject> ();
190 std::ostringstream oss;
193 std::ostringstream ref;
194 ref <<
"StringPair = { (hello,world) } DoubleIntPair = { (3.14,31) }";
211 :
TestSuite (
"pair-value-test-suite", UNIT)
Object holding pairs of values.
static TypeId GetTypeId()
Get the type ID.
std::pair< double, int > m_doubleIntPair
A pair of double, int.
std::pair< std::string, std::string > m_stringPair
A string pair.
friend std::ostream & operator<<(std::ostream &os, const PairObject &obj)
Stream insertion operator.
Pair test - test setting through attribute interface.
PairValueSettingsTestCase()
void DoRun()
Implementation to actually run this TestCase.
Pair test - Test instantiation, initialization, access.
virtual void DoRun()
Implementation to actually run this TestCase.
virtual ~PairValueTestCase()
The pair-value Test Suite.
A base class which provides memory management and object aggregation.
Hold objects of type std::pair<A, B>.
void Set(const result_type &value)
Set the value.
result_type Get(void) const
Get the stored value as a std::pair.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
a unique identifier for an interface.
std::ostream & operator<<(std::ostream &os, TypeId tid)
Output streamer.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< const AttributeChecker > MakeStringChecker(void)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static PairValueTestSuite g_pairValueTestSuite
Static variable for test initialization.