OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 x = 200; | 202 x = 200; |
203 for (int i = 0; i < D / 2; ++i) { | 203 for (int i = 0; i < D / 2; ++i) { |
204 seq_nums_asc.insert(x); | 204 seq_nums_asc.insert(x); |
205 seq_nums_desc.insert(x); | 205 seq_nums_desc.insert(x); |
206 ASSERT_EQ(x, *seq_nums_asc.begin()); | 206 ASSERT_EQ(x, *seq_nums_asc.begin()); |
207 ASSERT_EQ(x, *seq_nums_desc.rbegin()); | 207 ASSERT_EQ(x, *seq_nums_desc.rbegin()); |
208 x = Add<D>(x, 1); | 208 x = Add<D>(x, 1); |
209 } | 209 } |
210 } | 210 } |
211 | 211 |
212 TEST(SeqNumUnwrapper, NoBackWardWrap) { | 212 // TODO(philipel): Enable when downstream project can hande these death tests. |
| 213 |
| 214 TEST(SeqNumUnwrapper, DISABLED_NoBackWardWrap) { |
213 SeqNumUnwrapper<uint8_t> unwrapper; | 215 SeqNumUnwrapper<uint8_t> unwrapper; |
214 EXPECT_EQ(0U, unwrapper.Unwrap(0)); | 216 EXPECT_EQ(0U, unwrapper.Unwrap(0)); |
215 | 217 |
216 // The unwrapped sequence is not allowed to wrap, if that happens the | 218 // The unwrapped sequence is not allowed to wrap, if that happens the |
217 // SeqNumUnwrapper should have been constructed with a higher start value. | 219 // SeqNumUnwrapper should have been constructed with a higher start value. |
218 ASSERT_DEATH_IF_SUPPORTED(unwrapper.Unwrap(255), ""); | 220 ASSERT_DEATH_IF_SUPPORTED(unwrapper.Unwrap(255), ""); |
219 } | 221 } |
220 | 222 |
221 TEST(SeqNumUnwrapper, NoForwardWrap) { | 223 TEST(SeqNumUnwrapper, DISABLED_NoForwardWrap) { |
222 SeqNumUnwrapper<uint32_t> unwrapper(std::numeric_limits<uint64_t>::max()); | 224 SeqNumUnwrapper<uint32_t> unwrapper(std::numeric_limits<uint64_t>::max()); |
223 EXPECT_EQ(std::numeric_limits<uint64_t>::max(), unwrapper.Unwrap(0)); | 225 EXPECT_EQ(std::numeric_limits<uint64_t>::max(), unwrapper.Unwrap(0)); |
224 | 226 |
225 // The unwrapped sequence is not allowed to wrap, if that happens the | 227 // The unwrapped sequence is not allowed to wrap, if that happens the |
226 // SeqNumUnwrapper should have been constructed with a lower start value. | 228 // SeqNumUnwrapper should have been constructed with a lower start value. |
227 ASSERT_DEATH_IF_SUPPORTED(unwrapper.Unwrap(1), ""); | 229 ASSERT_DEATH_IF_SUPPORTED(unwrapper.Unwrap(1), ""); |
228 } | 230 } |
229 | 231 |
230 TEST(SeqNumUnwrapper, ForwardWrap) { | 232 TEST(SeqNumUnwrapper, ForwardWrap) { |
231 SeqNumUnwrapper<uint8_t> unwrapper; | 233 SeqNumUnwrapper<uint8_t> unwrapper; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 uint16_t next_unwrap = 0; | 309 uint16_t next_unwrap = 0; |
308 uint64_t expected = kLargeNumber * kNumWraps; | 310 uint64_t expected = kLargeNumber * kNumWraps; |
309 for (uint16_t i = 0; i < kNumWraps * 2 + 1; ++i) { | 311 for (uint16_t i = 0; i < kNumWraps * 2 + 1; ++i) { |
310 EXPECT_EQ(expected, unwrapper.Unwrap(next_unwrap)); | 312 EXPECT_EQ(expected, unwrapper.Unwrap(next_unwrap)); |
311 expected -= kMaxStep; | 313 expected -= kMaxStep; |
312 next_unwrap = (next_unwrap + kMaxStep + 1) % kLargeNumber; | 314 next_unwrap = (next_unwrap + kMaxStep + 1) % kLargeNumber; |
313 } | 315 } |
314 } | 316 } |
315 | 317 |
316 } // namespace webrtc | 318 } // namespace webrtc |
OLD | NEW |