trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mas...@apache.org
Subject [trafficserver] 01/02: Update tests for Flow Controller
Date Tue, 05 Dec 2017 01:58:06 GMT
This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 7fcb88e2330696d357da60ea7698ea6c1f7b8914
Author: Masakazu Kitajo <maskit@apache.org>
AuthorDate: Tue Dec 5 10:50:00 2017 +0900

    Update tests for Flow Controller
---
 iocore/net/quic/test/test_QUICFlowController.cc | 123 ++++++++++++------------
 1 file changed, 60 insertions(+), 63 deletions(-)

diff --git a/iocore/net/quic/test/test_QUICFlowController.cc b/iocore/net/quic/test/test_QUICFlowController.cc
index 17a9472..b2a04c8 100644
--- a/iocore/net/quic/test/test_QUICFlowController.cc
+++ b/iocore/net/quic/test/test_QUICFlowController.cc
@@ -29,7 +29,7 @@
 
 TEST_CASE("QUICFlowController_Local_Connection", "[quic]")
 {
-  std::unique_ptr<QUICError> error = nullptr;
+  int ret = 0;
   MockQUICFrameTransmitter tx;
   QUICLocalConnectionFlowController fc(1024, &tx);
 
@@ -37,39 +37,38 @@ TEST_CASE("QUICFlowController_Local_Connection", "[quic]")
   CHECK(fc.current_offset() == 0);
   CHECK(fc.current_limit() == 1024);
 
-  error = fc.update(256);
+  ret = fc.update(256);
   CHECK(fc.current_offset() == 256);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
-  error = fc.update(512);
+  ret = fc.update(512);
   CHECK(fc.current_offset() == 512);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
   // Retransmit
-  error = fc.update(512);
+  ret = fc.update(512);
   CHECK(fc.current_offset() == 512);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
-  error = fc.update(1024);
+  ret = fc.update(1024);
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
   // Delay
-  error = fc.update(512);
+  ret = fc.update(512);
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
   // Exceed limit
-  error = fc.update(1280);
+  ret = fc.update(1280);
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::TRANSPORT);
-  CHECK(error->trans_error_code == QUICTransErrorCode::FLOW_CONTROL_ERROR);
+  CHECK(ret != 0);
 
   // MAX_STREAM_DATA
   CHECK(tx.frameCount[static_cast<int>(QUICFrameType::MAX_DATA)] == 0);
@@ -78,15 +77,15 @@ TEST_CASE("QUICFlowController_Local_Connection", "[quic]")
   CHECK(fc.current_limit() == 2048);
   CHECK(tx.frameCount[static_cast<int>(QUICFrameType::MAX_DATA)] == 1);
 
-  error = fc.update(1280);
+  ret = fc.update(1280);
   CHECK(fc.current_offset() == 1280);
   CHECK(fc.current_limit() == 2048);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 }
 
 TEST_CASE("QUICFlowController_Remote_Connection", "[quic]")
 {
-  std::unique_ptr<QUICError> error = nullptr;
+  int ret = 0;
   MockQUICFrameTransmitter tx;
   QUICRemoteConnectionFlowController fc(1024, &tx);
 
@@ -94,39 +93,39 @@ TEST_CASE("QUICFlowController_Remote_Connection", "[quic]")
   CHECK(fc.current_offset() == 0);
   CHECK(fc.current_limit() == 1024);
 
-  error = fc.update(256);
+  ret = fc.update(256);
   CHECK(fc.current_offset() == 256);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
-  error = fc.update(512);
+  ret = fc.update(512);
   CHECK(fc.current_offset() == 512);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
   // Retransmit
-  error = fc.update(512);
+  ret = fc.update(512);
   CHECK(fc.current_offset() == 512);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
-  error = fc.update(1024);
+  ret = fc.update(1024);
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
   // Delay
-  error = fc.update(512);
+  ret = fc.update(512);
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
   // Exceed limit
   CHECK(tx.frameCount[static_cast<int>(QUICFrameType::BLOCKED)] == 0);
-  error = fc.update(1280);
+  ret = fc.update(1280);
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls != QUICErrorClass::NONE);
+  CHECK(ret != 0);
   CHECK(tx.frameCount[static_cast<int>(QUICFrameType::BLOCKED)] == 1);
 
   // MAX_STREAM_DATA
@@ -134,15 +133,15 @@ TEST_CASE("QUICFlowController_Remote_Connection", "[quic]")
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 2048);
 
-  error = fc.update(1280);
+  ret = fc.update(1280);
   CHECK(fc.current_offset() == 1280);
   CHECK(fc.current_limit() == 2048);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 }
 
 TEST_CASE("QUICFlowController_Local_Stream", "[quic]")
 {
-  std::unique_ptr<QUICError> error = nullptr;
+  int ret = 0;
   MockQUICFrameTransmitter tx;
   QUICLocalStreamFlowController fc(1024, &tx, 0);
 
@@ -150,39 +149,38 @@ TEST_CASE("QUICFlowController_Local_Stream", "[quic]")
   CHECK(fc.current_offset() == 0);
   CHECK(fc.current_limit() == 1024);
 
-  error = fc.update(256);
+  ret = fc.update(256);
   CHECK(fc.current_offset() == 256);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
-  error = fc.update(512);
+  ret = fc.update(512);
   CHECK(fc.current_offset() == 512);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
   // Retransmit
-  error = fc.update(512);
+  ret = fc.update(512);
   CHECK(fc.current_offset() == 512);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
-  error = fc.update(1024);
+  ret = fc.update(1024);
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
   // Delay
-  error = fc.update(512);
+  ret = fc.update(512);
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
   // Exceed limit
-  error = fc.update(1280);
+  ret = fc.update(1280);
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::TRANSPORT);
-  CHECK(error->trans_error_code == QUICTransErrorCode::FLOW_CONTROL_ERROR);
+  CHECK(ret != 0);
 
   // MAX_STREAM_DATA
   CHECK(tx.frameCount[static_cast<int>(QUICFrameType::MAX_STREAM_DATA)] == 0);
@@ -191,15 +189,15 @@ TEST_CASE("QUICFlowController_Local_Stream", "[quic]")
   CHECK(fc.current_limit() == 2048);
   CHECK(tx.frameCount[static_cast<int>(QUICFrameType::MAX_STREAM_DATA)] == 1);
 
-  error = fc.update(1280);
+  ret = fc.update(1280);
   CHECK(fc.current_offset() == 1280);
   CHECK(fc.current_limit() == 2048);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 }
 
 TEST_CASE("QUICFlowController_Remote_Stream", "[quic]")
 {
-  std::unique_ptr<QUICError> error = nullptr;
+  int ret = 0;
   MockQUICFrameTransmitter tx;
   QUICRemoteStreamFlowController fc(1024, &tx, 0);
 
@@ -207,48 +205,47 @@ TEST_CASE("QUICFlowController_Remote_Stream", "[quic]")
   CHECK(fc.current_offset() == 0);
   CHECK(fc.current_limit() == 1024);
 
-  error = fc.update(256);
+  ret = fc.update(256);
   CHECK(fc.current_offset() == 256);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
-  error = fc.update(512);
+  ret = fc.update(512);
   CHECK(fc.current_offset() == 512);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
   // Retransmit
-  error = fc.update(512);
+  ret = fc.update(512);
   CHECK(fc.current_offset() == 512);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
-  error = fc.update(1024);
+  ret = fc.update(1024);
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
   // Delay
-  error = fc.update(512);
+  ret = fc.update(512);
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 
   // Exceed limit
   CHECK(tx.frameCount[static_cast<int>(QUICFrameType::STREAM_BLOCKED)] == 0);
-  error = fc.update(1280);
+  ret = fc.update(1280);
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 1024);
-  CHECK(error->cls != QUICErrorClass::NONE);
-  CHECK(tx.frameCount[static_cast<int>(QUICFrameType::STREAM_BLOCKED)] == 1);
+  CHECK(ret != 0);
 
   // MAX_STREAM_DATA
   fc.forward_limit(2048);
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 2048);
 
-  error = fc.update(1280);
+  ret = fc.update(1280);
   CHECK(fc.current_offset() == 1280);
   CHECK(fc.current_limit() == 2048);
-  CHECK(error->cls == QUICErrorClass::NONE);
+  CHECK(ret == 0);
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.

Mime
View raw message