From 9938e70cb7967fdd79f90fc356ec6f3342ba1a9a Mon Sep 17 00:00:00 2001 From: Tommaso Pecorella Date: Tue, 22 Sep 2020 11:57:56 +0200 Subject: [PATCH] core: fix test linking Address from network module --- src/core/test/pair-value-test-suite.cc | 32 +++++++++++--------------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/core/test/pair-value-test-suite.cc b/src/core/test/pair-value-test-suite.cc index e8d83011e..87da18ad7 100644 --- a/src/core/test/pair-value-test-suite.cc +++ b/src/core/test/pair-value-test-suite.cc @@ -27,8 +27,6 @@ #include #include #include -#include -#include #include #include @@ -52,8 +50,8 @@ public: friend std::ostream &operator <<(std::ostream &os, const PairObject &obj); private: - std::pair m_stringpair; - std::pair m_addresspair; + std::pair m_stringPair; + std::pair m_doubleIntPair; }; PairObject::PairObject () @@ -75,13 +73,13 @@ PairObject::GetTypeId () .AddConstructor () .AddAttribute ("StringPair", "Pair: string, string", PairValue (), - MakePairAccessor (&PairObject::m_stringpair), + MakePairAccessor (&PairObject::m_stringPair), MakePairChecker (MakeStringChecker (), MakeStringChecker ())) - .AddAttribute ("AddressPair", "Pair: address int", + .AddAttribute ("DoubleIntPair", "Pair: double int", // the container value container differs from the underlying object - PairValue (), - MakePairAccessor (&PairObject::m_addresspair), - MakePairChecker (MakeAddressChecker (), MakeIntegerChecker ())) + PairValue (), + MakePairAccessor (&PairObject::m_doubleIntPair), + MakePairChecker (MakeDoubleChecker (), MakeIntegerChecker ())) ; return tid; } @@ -89,8 +87,8 @@ PairObject::GetTypeId () std::ostream & operator << (std::ostream &os, const PairObject &obj) { - os << "StringPair = { " << obj.m_stringpair << " } "; - os << "AddressPair = { " << obj.m_addresspair << " }"; + os << "StringPair = { " << obj.m_stringPair << " } "; + os << "DoubleIntPair = { " << obj.m_doubleIntPair << " }"; return os; } @@ -124,11 +122,11 @@ PairValueTestCase::DoRun () } { - std::pair ref = {"hello", Mac48Address::Allocate ()}; + std::pair ref = {"hello", 3.14}; - PairValue ac; + PairValue ac; ac.Set (ref); - std::pair rv = ac.Get (); + std::pair rv = ac.Get (); NS_TEST_ASSERT_MSG_EQ (rv, ref, "Attribute value does not equal original"); } @@ -149,17 +147,15 @@ PairValueSettingsTestCase::PairValueSettingsTestCase () void PairValueSettingsTestCase::DoRun () { - Address addr = Mac48Address::Allocate (); - auto p = CreateObject (); p->SetAttribute ("StringPair", PairValue (std::make_pair ("hello", "world"))); - p->SetAttribute ("AddressPair", PairValue (std::make_pair (addr, 31))); + p->SetAttribute ("DoubleIntPair", PairValue (std::make_pair (3.14, 31))); std::ostringstream oss; oss << *p; std::ostringstream ref; - ref << "StringPair = { (hello,world) } AddressPair = { (" << addr << ",31) }"; + ref << "StringPair = { (hello,world) } DoubleIntPair = { (3.14,31) }"; NS_TEST_ASSERT_MSG_EQ ((oss.str ()), (ref.str ()), "Pairs not correctly set"); }