src/net/third_party/quiche/src/quic/core/quic_interval_deque_test.cc
// The goal of this test is to push data into the container at specific
// intervals and show how the |DataAt| can iterate over already scanned data.
The goal of this test is to push data into the container at specific
intervals and show how the |DataAt| can iterate over already scanned data.
The goal of this test is to push data into the container at specific intervals and show how the |DataAt| can iterate over already scanned data .
TEST_F(QuicIntervalDequeTest, RescanData) {
  const int32_t index = QuicIntervalDequePeer::GetCachedIndex(&qid_);
  EXPECT_EQ(index, 0);
  auto it = qid_.DataBegin();
  auto end = qid_.DataEnd();
  for (int32_t i = 0; i < kSize - 1; ++i, ++it) {
    EXPECT_EQ(it->val, i);
    const std::size_t current_iteraval_begin = i * kIntervalStep;
    auto lookup = qid_.DataAt(current_iteraval_begin);
    EXPECT_EQ(i, lookup->val);
    const int32_t cached_index_before =
        QuicIntervalDequePeer::GetCachedIndex(&qid_);
    EXPECT_EQ(cached_index_before, i);
    const int32_t index_before = QuicIntervalDequePeer::GetCachedIndex(&qid_);
    const int32_t before_i = i;
    EXPECT_EQ(index_before, before_i);
    lookup++;
    const int32_t cached_index_after =
        QuicIntervalDequePeer::GetCachedIndex(&qid_);
    const int32_t after_i = (i + 1);
    EXPECT_EQ(cached_index_after, after_i);
    EXPECT_NE(it, end);
  }
  int32_t expected_index = static_cast<int32_t>(kSize - 1);
  for (int32_t i = 0; i < kSize - 1; ++i) {
    const std::size_t current_iteraval_begin = i * kIntervalStep;
    auto lookup = qid_.DataAt(current_iteraval_begin);
    EXPECT_EQ(i, lookup->val);
    lookup++;
    const int32_t index_after = QuicIntervalDequePeer::GetCachedIndex(&qid_);
    EXPECT_EQ(index_after, expected_index);
    EXPECT_NE(it, end);
  }
}
TEST_F ( QuicIntervalDequeTest , RescanData ) { const int32_t index = QuicIntervalDequePeer :: GetCachedIndex ( & qid_ ) ; EXPECT_EQ ( index , 0 ) ; auto it = qid_ . DataBegin ( ) ; auto end = qid_ . DataEnd ( ) ; for ( int32_t i = 0 ; i < kSize - 1 ; ++ i , ++ it ) { EXPECT_EQ ( it -> val , i ) ; const std :: size_t current_iteraval_begin = i * kIntervalStep ; auto lookup = qid_ . DataAt ( current_iteraval_begin ) ; EXPECT_EQ ( i , lookup -> val ) ; const int32_t cached_index_before = QuicIntervalDequePeer :: GetCachedIndex ( & qid_ ) ; EXPECT_EQ ( cached_index_before , i ) ; const int32_t index_before = QuicIntervalDequePeer :: GetCachedIndex ( & qid_ ) ; const int32_t before_i = i ; EXPECT_EQ ( index_before , before_i ) ; lookup ++ ; const int32_t cached_index_after = QuicIntervalDequePeer :: GetCachedIndex ( & qid_ ) ; const int32_t after_i = ( i + 1 ) ; EXPECT_EQ ( cached_index_after , after_i ) ; EXPECT_NE ( it , end ) ; } int32_t expected_index = static_cast < int32_t > ( kSize - 1 ) ; for ( int32_t i = 0 ; i < kSize - 1 ; ++ i ) { const std :: size_t current_iteraval_begin = i * kIntervalStep ; auto lookup = qid_ . DataAt ( current_iteraval_begin ) ; EXPECT_EQ ( i , lookup -> val ) ; lookup ++ ; const int32_t index_after = QuicIntervalDequePeer :: GetCachedIndex ( & qid_ ) ; EXPECT_EQ ( index_after , expected_index ) ; EXPECT_NE ( it , end ) ; } }
The goal of this test is to push data into the container at specific
intervals and show how the |DataAt| can iterate over already scanned data.
The goal of this test is to push data into the container at specific intervals and show how the |DataAt| can iterate over already scanned data .
// The write index should point to the beginning of the container. // The |DataAt| method should find the correct interval. // Make sure the index has changed just from using |DataAt| // Ensure the real index has changed just from using |DataAt| and the // off-by-one logic // This increment should move the cached index forward. // Check that the cached index has moved foward. // Iterate over items which have been consumed before. // The |DataAt| method should find the correct interval. // This increment shouldn't move the index forward as the index is currently // ahead. // Check that the index hasn't moved foward.