fix ns3-tcp-cwnd unit test

This commit is contained in:
Craig Dowell
2009-10-09 15:52:01 -07:00
parent 4ce4288ecb
commit dafb0530cc
2 changed files with 7 additions and 12 deletions

View File

@@ -345,25 +345,20 @@ Ns3TcpCwndTestCase1::DoRun (void)
// reflecting the change from LARGEST_CWND back to MSS
//
const uint32_t MSS = 536;
const uint32_t N_EVENTS = 21;
const uint32_t LARGEST_CWND = MSS * N_EVENTS;
const uint32_t N_EVENTS = 20;
CwndEvent event;
NS_TEST_ASSERT_MSG_EQ (m_responses.GetN (), N_EVENTS, "Unexpectedly low number of cwnd change events");
for (uint32_t i = 0, from = 536, to = 1072; i < N_EVENTS - 1; ++i, from += 536, to += 536)
for (uint32_t i = 0, from = MSS, to = MSS * 2; i < N_EVENTS; ++i, from += MSS, to += MSS)
{
event = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (event.m_oldCwnd, from, "Wrong old cwnd value in cwnd change event " << i);
NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, to, "Wrong new cwnd value in cwnd change event " << i);
}
event = m_responses.Get (N_EVENTS - 1);
NS_TEST_ASSERT_MSG_EQ (event.m_oldCwnd, LARGEST_CWND, "Wrong old cwnd value in cwnd change event " << N_EVENTS - 1);
NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, MSS, "Wrong new cwnd value in cwnd change event " << N_EVENTS - 1);
return GetErrorStatus ();
}
@@ -523,19 +518,19 @@ Ns3TcpCwndTestCase2::DoRun (void)
NS_TEST_ASSERT_MSG_EQ (m_responses.GetN (), 31, "Unexpected number of cwnd change events");
for (uint32_t i = 0, from = 536, to = 1072; i < 9; ++i, from += 536, to += 536)
for (uint32_t i = 0, from = MSS, to = MSS * 2; i < 9; ++i, from += MSS, to += MSS)
{
event = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (event.m_oldCwnd, from, "Wrong old cwnd value in cwnd change event " << i);
NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, to, "Wrong new cwnd value in cwnd change event " << i);
}
// Cwnd should be back to 536
// Cwnd should be back to MSS
event = m_responses.Get (9);
NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, MSS, "Wrong new cwnd value in cwnd change event " << 9);
// Another round of slow start
for (uint32_t i = 10, from = 536, to = 1072; i < 14; ++i, from += 536, to += 536)
for (uint32_t i = 10, from = MSS, to = MSS * 2; i < 14; ++i, from += MSS, to += MSS)
{
event = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (event.m_oldCwnd, from, "Wrong old cwnd value in cwnd change event " << i);
@@ -556,7 +551,7 @@ Ns3TcpCwndTestCase2::DoRun (void)
<< i);
}
// Cwnd should be back to 536
// Cwnd should be back to MSS
event = m_responses.Get (29);
NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, MSS, "Wrong new cwnd value in cwnd change event " << 29);

View File

@@ -1233,7 +1233,7 @@ def run_tests():
if len(options.xml):
shutil.copyfile(xml_results_file, options.xml)
if passed_tests == total_tests:
if passed_tests + skipped_tests == total_tests:
return 0 # success
else:
return 1 # catchall for general errors