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 |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "webrtc/test/gtest.h" |
12 | 12 |
13 #include "webrtc/modules/audio_processing/utility/block_mean_calculator.h" | 13 #include "webrtc/modules/audio_processing/utility/block_mean_calculator.h" |
14 | 14 |
15 namespace webrtc { | 15 namespace webrtc { |
16 | 16 |
17 TEST(MeanCalculatorTest, Correctness) { | 17 TEST(MeanCalculatorTest, Correctness) { |
18 const size_t kBlockLength = 10; | 18 const size_t kBlockLength = 10; |
19 BlockMeanCalculator mean_calculator(kBlockLength); | 19 BlockMeanCalculator mean_calculator(kBlockLength); |
20 size_t i = 0; | 20 size_t i = 0; |
21 float reference = 0.0; | 21 float reference = 0.0; |
(...skipping 28 matching lines...) Expand all Loading... |
50 for (; i < kBlockLength - 1; ++i) { | 50 for (; i < kBlockLength - 1; ++i) { |
51 mean_calculator.AddValue(static_cast<float>(i)); | 51 mean_calculator.AddValue(static_cast<float>(i)); |
52 EXPECT_FALSE(mean_calculator.EndOfBlock()); | 52 EXPECT_FALSE(mean_calculator.EndOfBlock()); |
53 } | 53 } |
54 mean_calculator.AddValue(static_cast<float>(i)); | 54 mean_calculator.AddValue(static_cast<float>(i)); |
55 EXPECT_TRUE(mean_calculator.EndOfBlock()); | 55 EXPECT_TRUE(mean_calculator.EndOfBlock()); |
56 EXPECT_EQ(mean_calculator.GetLatestMean(), 0.5 * (kBlockLength - 1)); | 56 EXPECT_EQ(mean_calculator.GetLatestMean(), 0.5 * (kBlockLength - 1)); |
57 } | 57 } |
58 | 58 |
59 } // namespace webrtc | 59 } // namespace webrtc |
OLD | NEW |