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

Side by Side Diff: webrtc/modules/audio_processing/echo_detector/circular_buffer_unittest.cc

Issue 2419563003: Add algorithm for Residual Echo Detector. (Closed)
Patch Set: Merged residual_echo_detector and echo_detector. Created 4 years, 1 month 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
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/modules/audio_processing/echo_detector/circular_buffer.h"
12 #include "webrtc/test/gtest.h"
13
14 namespace webrtc {
15
16 TEST(CircularBufferTests, LessThanMaxTest) {
17 CircularBuffer test_buffer(3);
18 test_buffer.Push(1.f);
19 test_buffer.Push(2.f);
20 EXPECT_EQ(rtc::Optional<float>(1.f), test_buffer.Pop());
21 EXPECT_EQ(rtc::Optional<float>(2.f), test_buffer.Pop());
22 }
23
24 TEST(CircularBufferTests, FillTest) {
25 CircularBuffer test_buffer(3);
26 test_buffer.Push(1.f);
27 test_buffer.Push(2.f);
28 test_buffer.Push(3.f);
29 EXPECT_EQ(rtc::Optional<float>(1.f), test_buffer.Pop());
30 EXPECT_EQ(rtc::Optional<float>(2.f), test_buffer.Pop());
31 EXPECT_EQ(rtc::Optional<float>(3.f), test_buffer.Pop());
32 }
33
34 TEST(CircularBufferTests, OverflowTest) {
35 CircularBuffer test_buffer(3);
36 test_buffer.Push(1.f);
37 test_buffer.Push(2.f);
38 test_buffer.Push(3.f);
39 test_buffer.Push(4.f);
40 // Because the circular buffer has a size of 3, the first insert should have
41 // been forgotten.
42 EXPECT_EQ(rtc::Optional<float>(2.f), test_buffer.Pop());
43 EXPECT_EQ(rtc::Optional<float>(3.f), test_buffer.Pop());
44 EXPECT_EQ(rtc::Optional<float>(4.f), test_buffer.Pop());
45 }
46
47 TEST(CircularBufferTests, ReadFromEmpty) {
48 CircularBuffer test_buffer(3);
49 EXPECT_EQ(rtc::Optional<float>(), test_buffer.Pop());
50 }
51
52 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698