Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: webrtc/modules/module_common_types_unittest.cc

Issue 2424173003: Move functionality out from AudioFrame and into AudioFrameOperations. (Closed)
Patch Set: Include order & DCHECKs. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/include/module_common_types.h ('k') | webrtc/modules/utility/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 EXPECT_EQ(0x00000000u, LatestTimestamp(0x00000000, 0xFFFF0000)); 105 EXPECT_EQ(0x00000000u, LatestTimestamp(0x00000000, 0xFFFF0000));
106 EXPECT_EQ(0x0000FFFFu, LatestTimestamp(0x0000FFFF, 0xFFFFFFFF)); 106 EXPECT_EQ(0x0000FFFFu, LatestTimestamp(0x0000FFFF, 0xFFFFFFFF));
107 EXPECT_EQ(0x0000FFFFu, LatestTimestamp(0x0000FFFF, 0xFFFF0000)); 107 EXPECT_EQ(0x0000FFFFu, LatestTimestamp(0x0000FFFF, 0xFFFF0000));
108 108
109 EXPECT_EQ(0x00000000u, LatestTimestamp(0xFFFFFFFF, 0x00000000)); 109 EXPECT_EQ(0x00000000u, LatestTimestamp(0xFFFFFFFF, 0x00000000));
110 EXPECT_EQ(0x00000000u, LatestTimestamp(0xFFFF0000, 0x00000000)); 110 EXPECT_EQ(0x00000000u, LatestTimestamp(0xFFFF0000, 0x00000000));
111 EXPECT_EQ(0x0000FFFFu, LatestTimestamp(0xFFFFFFFF, 0x0000FFFF)); 111 EXPECT_EQ(0x0000FFFFu, LatestTimestamp(0xFFFFFFFF, 0x0000FFFF));
112 EXPECT_EQ(0x0000FFFFu, LatestTimestamp(0xFFFF0000, 0x0000FFFF)); 112 EXPECT_EQ(0x0000FFFFu, LatestTimestamp(0xFFFF0000, 0x0000FFFF));
113 } 113 }
114 114
115 TEST(ClampToInt16, TestCases) {
116 EXPECT_EQ(0x0000, ClampToInt16(0x00000000));
117 EXPECT_EQ(0x0001, ClampToInt16(0x00000001));
118 EXPECT_EQ(0x7FFF, ClampToInt16(0x00007FFF));
119 EXPECT_EQ(0x7FFF, ClampToInt16(0x7FFFFFFF));
120 EXPECT_EQ(-0x0001, ClampToInt16(-0x00000001));
121 EXPECT_EQ(-0x8000, ClampToInt16(-0x8000));
122 EXPECT_EQ(-0x8000, ClampToInt16(-0x7FFFFFFF));
123 }
124 115
125 TEST(SequenceNumberUnwrapper, Limits) { 116 TEST(SequenceNumberUnwrapper, Limits) {
126 SequenceNumberUnwrapper unwrapper; 117 SequenceNumberUnwrapper unwrapper;
127 118
128 EXPECT_EQ(0, unwrapper.Unwrap(0)); 119 EXPECT_EQ(0, unwrapper.Unwrap(0));
129 EXPECT_EQ(0x8000, unwrapper.Unwrap(0x8000)); 120 EXPECT_EQ(0x8000, unwrapper.Unwrap(0x8000));
130 // Delta is exactly 0x8000 but current is lower than input, wrap backwards. 121 // Delta is exactly 0x8000 but current is lower than input, wrap backwards.
131 EXPECT_EQ(0x0, unwrapper.Unwrap(0x0000)); 122 EXPECT_EQ(0x0, unwrapper.Unwrap(0x0000));
132 123
133 EXPECT_EQ(0x8000, unwrapper.Unwrap(0x8000)); 124 EXPECT_EQ(0x8000, unwrapper.Unwrap(0x8000));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 166
176 seq = kNumWraps * 0xFFFF; 167 seq = kNumWraps * 0xFFFF;
177 unwrapper.UpdateLast(seq); 168 unwrapper.UpdateLast(seq);
178 for (; seq >= 0; --seq) { 169 for (; seq >= 0; --seq) {
179 int64_t unwrapped = unwrapper.Unwrap(static_cast<uint16_t>(seq & 0xFFFF)); 170 int64_t unwrapped = unwrapper.Unwrap(static_cast<uint16_t>(seq & 0xFFFF));
180 EXPECT_EQ(seq, unwrapped); 171 EXPECT_EQ(seq, unwrapped);
181 } 172 }
182 } 173 }
183 174
184 } // namespace webrtc 175 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/include/module_common_types.h ('k') | webrtc/modules/utility/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698