Index: webrtc/modules/audio_processing/aec3/aec3_constants_unittest.cc |
diff --git a/webrtc/modules/audio_processing/aec3/aec3_constants_unittest.cc b/webrtc/modules/audio_processing/aec3/aec3_constants_unittest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d9e84259226c54bac53ad2997d3e5a0778ec9f9a |
--- /dev/null |
+++ b/webrtc/modules/audio_processing/aec3/aec3_constants_unittest.cc |
@@ -0,0 +1,46 @@ |
+/* |
+ * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+ |
+#include <string> |
+ |
+#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.
|
+#include "webrtc/test/gtest.h" |
+ |
+namespace webrtc { |
+ |
+namespace { |
+ |
+std::string ProduceDebugText(int sample_rate_hz) { |
+ std::ostringstream ss; |
+ ss << "Sample rate: " << sample_rate_hz; |
+ return ss.str(); |
+} |
+ |
+} // namespace |
+ |
+TEST(BandSplitting, NumBandsForRate) { |
+ 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.
|
+ EXPECT_EQ(1u, NumBandsForRate(16000)); |
+ EXPECT_EQ(2u, NumBandsForRate(32000)); |
+ EXPECT_EQ(3u, NumBandsForRate(48000)); |
+} |
+ |
+TEST(BandSplitting, LowestBandRate) { |
+ { |
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.
|
+ SCOPED_TRACE(ProduceDebugText(8000)); |
+ EXPECT_EQ(8000, LowestBandRate(8000)); |
+ } |
+ for (auto rate : {16000, 32000, 48000}) { |
+ SCOPED_TRACE(ProduceDebugText(rate)); |
+ EXPECT_EQ(16000, LowestBandRate(rate)); |
+ } |
+} |
+ |
+} // namespace webrtc |