20 #include <ns3/double.h>
21 #include <ns3/integer.h>
23 #include <ns3/object.h>
26 #include <ns3/string.h>
28 #include <ns3/type-id.h>
92 "Pair: string, string",
96 .AddAttribute(
"DoubleIntPair",
101 MakePairChecker<DoubleValue, IntegerValue>(MakeDoubleChecker<double>(),
102 MakeIntegerChecker<int>()));
136 void DoRun()
override;
140 :
TestCase(
"test instantiation, initialization, access")
148 std::pair<const int, double> ref = {1, 2.4};
152 std::pair<const int, double> rv = ac.
Get();
157 std::pair<const std::string, double> ref = {
"hello", 3.14};
161 std::pair<const std::string, double> rv = ac.
Get();
176 void DoRun()
override;
180 :
TestCase(
"test setting through attribute interface")
187 auto p = CreateObject<PairObject>();
188 p->SetAttribute(
"StringPair",
190 p->SetAttribute(
"DoubleIntPair",
193 std::ostringstream oss;
196 std::ostringstream ref;
197 ref <<
"StringPair = { (hello,world) } DoubleIntPair = { (3.14,31) }";
214 :
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.
Pair test - test setting through attribute interface.
PairValueSettingsTestCase()
void DoRun() override
Implementation to actually run this TestCase.
Pair test - Test instantiation, initialization, access.
~PairValueTestCase() override
void DoRun() override
Implementation to actually run this TestCase.
The pair-value Test Suite.
A base class which provides memory management and object aggregation.
Hold objects of type std::pair<A, B>.
result_type Get() const
Get the stored value as a std::pair.
void Set(const result_type &value)
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#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.
Ptr< const AttributeChecker > MakeStringChecker()
std::ostream & operator<<(std::ostream &os, const Angles &a)
static PairValueTestSuite g_pairValueTestSuite
Static variable for test initialization.