Index: webrtc/modules/audio_processing/test/analog_volume_mapper_unittest.cc |
diff --git a/webrtc/modules/audio_processing/test/analog_volume_mapper_unittest.cc b/webrtc/modules/audio_processing/test/analog_volume_mapper_unittest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..98c932f6445848a4f599628b3f80d2b26ef0a74c |
--- /dev/null |
+++ b/webrtc/modules/audio_processing/test/analog_volume_mapper_unittest.cc |
@@ -0,0 +1,26 @@ |
+/* |
+ * Copyright (c) 2017 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 "webrtc/modules/audio_processing/test/identity_analog_volume_mapper.h" |
+#include "webrtc/test/gtest.h" |
+ |
aleloi
2017/04/21 09:39:14
The idea is to submit all subclasses of the Volume
AleBzk
2017/04/21 10:35:49
Acknowledged.
|
+TEST(AnalogVolumeMapper, GainCurveShouldBeMonotone) { |
+ webrtc::IdentityAnalogLevelMapper level_mapper; |
+ float last_level = level_mapper.get_scaling_factor(); |
+ RTC_DCHECK_LE(0.f, last_level); |
+ |
+ for (int i = 0; i < 65535; ++i) { |
+ level_mapper.set_analog_level(i); |
+ const float current_level = level_mapper.get_scaling_factor(); |
+ RTC_DCHECK_LE(last_level, current_level); |
+ |
+ last_level = current_level; |
+ } |
+} |