OLD | NEW |
---|---|
(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 <string> | |
12 | |
13 #include "webrtc/modules/audio_processing/aec3/aec3_constants.h" | |
hlundin-webrtc
2016/12/22 10:23:56
In unit tests, the .h file associated with the cod
peah-webrtc
2016/12/22 16:40:03
Thanks!
Done.
| |
14 #include "webrtc/test/gtest.h" | |
15 | |
16 namespace webrtc { | |
17 | |
18 namespace { | |
19 | |
20 std::string ProduceDebugText(int sample_rate_hz) { | |
21 std::ostringstream ss; | |
22 ss << "Sample rate: " << sample_rate_hz; | |
23 return ss.str(); | |
24 } | |
25 | |
26 } // namespace | |
27 | |
28 TEST(BandSplitting, NumBandsForRate) { | |
29 EXPECT_EQ(1u, NumBandsForRate(8000)); | |
ivoc
2016/12/22 13:38:13
I think this test is fine, but a nice alternative
peah-webrtc
2016/12/22 16:40:03
Great point! Done.
| |
30 EXPECT_EQ(1u, NumBandsForRate(16000)); | |
31 EXPECT_EQ(2u, NumBandsForRate(32000)); | |
32 EXPECT_EQ(3u, NumBandsForRate(48000)); | |
33 } | |
34 | |
35 TEST(BandSplitting, LowestBandRate) { | |
36 { | |
hlundin-webrtc
2016/12/22 10:23:56
Explicitly write all the test cases, like you do a
ivoc
2016/12/22 13:38:13
Why the extra braces?
peah-webrtc
2016/12/22 16:40:03
Afaics those are needed for the scoped trace to en
peah-webrtc
2016/12/22 16:40:03
Done.
| |
37 SCOPED_TRACE(ProduceDebugText(8000)); | |
38 EXPECT_EQ(8000, LowestBandRate(8000)); | |
39 } | |
40 for (auto rate : {16000, 32000, 48000}) { | |
41 SCOPED_TRACE(ProduceDebugText(rate)); | |
42 EXPECT_EQ(16000, LowestBandRate(rate)); | |
43 } | |
44 } | |
45 | |
46 } // namespace webrtc | |
OLD | NEW |