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> 74 .AddAttribute (
"StringPair",
"Pair: string, string",
78 .AddAttribute (
"DoubleIntPair",
"Pair: double int",
82 MakePairChecker<DoubleValue, IntegerValue> (MakeDoubleChecker<double> (), MakeIntegerChecker<int> ()))
103 virtual void DoRun ();
107 :
TestCase (
"test instantiation, initialization, access")
116 std::pair<const int, double> ref = {1, 2.4};
120 std::pair<const int, double> rv = ac.
Get ();
125 std::pair<const std::string, double> ref = {
"hello", 3.14};
129 std::pair<const std::string, double> rv = ac.
Get ();
144 :
TestCase (
"test setting through attribute interface")
150 auto p = CreateObject <PairObject> ();
154 std::ostringstream oss;
157 std::ostringstream ref;
158 ref <<
"StringPair = { (hello,world) } DoubleIntPair = { (3.14,31) }";
170 :
TestSuite (
"pair-value-test-suite", UNIT)
static PairValueTestSuite pairValueTestSuite
Static variable for test initialization.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
virtual void DoRun()
Implementation to actually run this TestCase.
std::pair< std::string, std::string > m_stringPair
virtual ~PairValueTestCase()
static TypeId GetTypeId()
std::ostream & operator<<(std::ostream &os, const Angles &a)
void Set(const result_type &value)
Set the stored value.
Ptr< const AttributeChecker > MakeStringChecker(void)
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
#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.
std::pair< double, int > m_doubleIntPair
Every class exported by the ns3 library is enclosed in the ns3 namespace.
PairValueSettingsTestCase()
result_type Get(void) const
Get the stored value as a std::pair.
A base class which provides memory management and object aggregation.
Hold objects of type std::pair<A, B>.
a unique identifier for an interface.
void DoRun()
Implementation to actually run this TestCase.
TypeId SetParent(TypeId tid)
Set the parent TypeId.