face: Incrementing Face counters
Change-Id: Ia1d7917bb52cf01ab2ff304638bc9f6cbdb2626f
Refs: #1178
diff --git a/tests/face/dummy-face.hpp b/tests/face/dummy-face.hpp
index e64a162..a28a1bb 100644
--- a/tests/face/dummy-face.hpp
+++ b/tests/face/dummy-face.hpp
@@ -28,6 +28,7 @@
virtual void
sendInterest(const Interest& interest)
{
+ this->onSendInterest(interest);
m_sentInterests.push_back(interest);
this->afterSend();
}
@@ -35,6 +36,7 @@
virtual void
sendData(const Data& data)
{
+ this->onSendData(data);
m_sentDatas.push_back(data);
this->afterSend();
}
diff --git a/tests/face/tcp.cpp b/tests/face/tcp.cpp
index 47c3b5b..332e28c 100644
--- a/tests/face/tcp.cpp
+++ b/tests/face/tcp.cpp
@@ -208,23 +208,39 @@
data2.setSignature(fakeSignature);
m_face1->sendInterest(interest1);
+ m_face1->sendInterest(interest1);
+ m_face1->sendInterest(interest1);
m_face1->sendData (data1 );
m_face2->sendInterest(interest2);
m_face2->sendData (data2 );
+ m_face2->sendData (data2 );
+ m_face2->sendData (data2 );
- BOOST_CHECK_MESSAGE(m_limitedIo.run(4, time::seconds(10)) == LimitedIo::EXCEED_OPS,
+ BOOST_CHECK_MESSAGE(m_limitedIo.run(8, time::seconds(10)) == LimitedIo::EXCEED_OPS,
"TcpChannel error: cannot send or receive Interest/Data packets");
BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
- BOOST_REQUIRE_EQUAL(m_face1_receivedDatas .size(), 1);
- BOOST_REQUIRE_EQUAL(m_face2_receivedInterests.size(), 1);
+ BOOST_REQUIRE_EQUAL(m_face1_receivedDatas .size(), 3);
+ BOOST_REQUIRE_EQUAL(m_face2_receivedInterests.size(), 3);
BOOST_REQUIRE_EQUAL(m_face2_receivedDatas .size(), 1);
BOOST_CHECK_EQUAL(m_face1_receivedInterests[0].getName(), interest2.getName());
BOOST_CHECK_EQUAL(m_face1_receivedDatas [0].getName(), data2.getName());
BOOST_CHECK_EQUAL(m_face2_receivedInterests[0].getName(), interest1.getName());
BOOST_CHECK_EQUAL(m_face2_receivedDatas [0].getName(), data1.getName());
+
+ const FaceCounters& counters1 = m_face1->getCounters();
+ BOOST_CHECK_EQUAL(counters1.getInInterest() , 1);
+ BOOST_CHECK_EQUAL(counters1.getInData() , 3);
+ BOOST_CHECK_EQUAL(counters1.getOutInterest(), 3);
+ BOOST_CHECK_EQUAL(counters1.getOutData() , 1);
+
+ const FaceCounters& counters2 = m_face2->getCounters();
+ BOOST_CHECK_EQUAL(counters2.getInInterest() , 3);
+ BOOST_CHECK_EQUAL(counters2.getInData() , 1);
+ BOOST_CHECK_EQUAL(counters2.getOutInterest(), 1);
+ BOOST_CHECK_EQUAL(counters2.getOutData() , 3);
}
BOOST_FIXTURE_TEST_CASE(EndToEnd6, EndToEndFixture)
diff --git a/tests/face/udp.cpp b/tests/face/udp.cpp
index f6ed53b..bab2f2b 100644
--- a/tests/face/udp.cpp
+++ b/tests/face/udp.cpp
@@ -411,6 +411,18 @@
BOOST_CHECK_EQUAL(m_face1_receivedInterests[1].getName(), interest3.getName());
BOOST_CHECK_EQUAL(m_face1_receivedDatas [3].getName(), data3.getName());
+
+ const FaceCounters& counters1 = m_face1->getCounters();
+ BOOST_CHECK_EQUAL(counters1.getInInterest() , 2);
+ BOOST_CHECK_EQUAL(counters1.getInData() , 4);
+ BOOST_CHECK_EQUAL(counters1.getOutInterest(), 3);
+ BOOST_CHECK_EQUAL(counters1.getOutData() , 1);
+
+ const FaceCounters& counters2 = m_face2->getCounters();
+ BOOST_CHECK_EQUAL(counters2.getInInterest() , 3);
+ BOOST_CHECK_EQUAL(counters2.getInData() , 1);
+ BOOST_CHECK_EQUAL(counters2.getOutInterest(), 2);
+ BOOST_CHECK_EQUAL(counters2.getOutData() , 4);
}
BOOST_FIXTURE_TEST_CASE(EndToEnd6, EndToEndFixture)
diff --git a/tests/face/unix-stream.cpp b/tests/face/unix-stream.cpp
index 09ee905..285b85f 100644
--- a/tests/face/unix-stream.cpp
+++ b/tests/face/unix-stream.cpp
@@ -174,22 +174,38 @@
data2.setSignature(fakeSignature);
m_face1->sendInterest(interest1);
+ m_face1->sendInterest(interest1);
+ m_face1->sendInterest(interest1);
m_face1->sendData (data1 );
m_face2->sendInterest(interest2);
m_face2->sendData (data2 );
+ m_face2->sendData (data2 );
+ m_face2->sendData (data2 );
- BOOST_CHECK_MESSAGE(m_limitedIo.run(4, time::seconds(1)) == LimitedIo::EXCEED_OPS,
+ BOOST_CHECK_MESSAGE(m_limitedIo.run(8, time::seconds(1)) == LimitedIo::EXCEED_OPS,
"UnixStreamChannel error: cannot send or receive Interest/Data packets");
BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
- BOOST_REQUIRE_EQUAL(m_face1_receivedDatas .size(), 1);
- BOOST_REQUIRE_EQUAL(m_face2_receivedInterests.size(), 1);
+ BOOST_REQUIRE_EQUAL(m_face1_receivedDatas .size(), 3);
+ BOOST_REQUIRE_EQUAL(m_face2_receivedInterests.size(), 3);
BOOST_REQUIRE_EQUAL(m_face2_receivedDatas .size(), 1);
BOOST_CHECK_EQUAL(m_face1_receivedInterests[0].getName(), interest2.getName());
BOOST_CHECK_EQUAL(m_face1_receivedDatas [0].getName(), data2.getName());
BOOST_CHECK_EQUAL(m_face2_receivedInterests[0].getName(), interest1.getName());
BOOST_CHECK_EQUAL(m_face2_receivedDatas [0].getName(), data1.getName());
+
+ const FaceCounters& counters1 = m_face1->getCounters();
+ BOOST_CHECK_EQUAL(counters1.getInInterest() , 1);
+ BOOST_CHECK_EQUAL(counters1.getInData() , 3);
+ BOOST_CHECK_EQUAL(counters1.getOutInterest(), 3);
+ BOOST_CHECK_EQUAL(counters1.getOutData() , 1);
+
+ const FaceCounters& counters2 = m_face2->getCounters();
+ BOOST_CHECK_EQUAL(counters2.getInInterest() , 3);
+ BOOST_CHECK_EQUAL(counters2.getInData() , 1);
+ BOOST_CHECK_EQUAL(counters2.getOutInterest(), 1);
+ BOOST_CHECK_EQUAL(counters2.getOutData() , 3);
}
BOOST_FIXTURE_TEST_CASE(MultipleAccepts, EndToEndFixture)