| 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..e564153c78e4db639156597c4d3483b8b3563069
|
| --- /dev/null
|
| +++ b/webrtc/modules/audio_processing/test/analog_volume_mapper_unittest.cc
|
| @@ -0,0 +1,30 @@
|
| +/*
|
| + * 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/analog_volume_mapper.h"
|
| +#include "webrtc/test/gtest.h"
|
| +
|
| +TEST(AnalogVolumeMapper, GainCurveShouldBeMonotone) {
|
| + using MappingKind = webrtc::AnalogLevelMapper::LevelToScalingMappingKind;
|
| +
|
| + for (auto kind : {MappingKind::kIdentity, MappingKind::kLinear}) {
|
| + webrtc::AnalogLevelMapper level_mapper(kind);
|
| + float last_level = level_mapper.GetScalingFactor();
|
| + RTC_DCHECK_LE(0.f, last_level);
|
| +
|
| + for (int i = 0; i < 255; ++i) {
|
| + level_mapper.set_analog_level(i);
|
| + const float current_level = level_mapper.GetScalingFactor();
|
| + RTC_DCHECK_LE(last_level, current_level);
|
| +
|
| + last_level = current_level;
|
| + }
|
| + }
|
| +}
|
|
|