blob: 8b0d5485b6d4fdce5c81ac5eaa7f0601ba4d7a91 [file] [log] [blame]
andrew@webrtc.org50b2efe2013-04-29 17:27:29 +00001/*
2 * Copyright (c) 2013 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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "common_audio/resampler/include/push_resampler.h"
Jonas Olssona4d87372019-07-05 19:08:33 +020012
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020013#include "rtc_base/checks.h" // RTC_DCHECK_IS_ON
14#include "test/gtest.h"
andrew@webrtc.org50b2efe2013-04-29 17:27:29 +000015
16// Quality testing of PushResampler is handled through output_mixer_unittest.cc.
17
18namespace webrtc {
19
Tommi0ad72ea2016-05-26 23:07:40 +020020// The below tests are temporarily disabled on WEBRTC_WIN due to problems
21// with clang debug builds.
Tommi90edc652016-05-26 23:48:16 +020022// TODO(tommi): Re-enable when we've figured out what the problem is.
23// http://crbug.com/615050
24#if !defined(WEBRTC_WIN) && defined(__clang__) && !defined(NDEBUG)
andrew@webrtc.orgc1eb5602013-06-03 19:00:29 +000025TEST(PushResamplerTest, VerifiesInputParameters) {
andrew@webrtc.orgf5a33f12014-04-19 00:32:07 +000026 PushResampler<int16_t> resampler;
andrew@webrtc.orgc1eb5602013-06-03 19:00:29 +000027 EXPECT_EQ(0, resampler.InitializeIfNeeded(16000, 16000, 1));
28 EXPECT_EQ(0, resampler.InitializeIfNeeded(16000, 16000, 2));
Alex Loiko3fc5a202018-10-02 14:09:46 +020029 EXPECT_EQ(0, resampler.InitializeIfNeeded(16000, 16000, 8));
andrew@webrtc.org50b2efe2013-04-29 17:27:29 +000030}
31
Tommi0ad72ea2016-05-26 23:07:40 +020032#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
Tommif9d2fe92016-05-26 22:21:31 +020033TEST(PushResamplerTest, VerifiesBadInputParameters1) {
34 PushResampler<int16_t> resampler;
35 EXPECT_DEATH(resampler.InitializeIfNeeded(-1, 16000, 1),
36 "src_sample_rate_hz");
37}
38
39TEST(PushResamplerTest, VerifiesBadInputParameters2) {
40 PushResampler<int16_t> resampler;
41 EXPECT_DEATH(resampler.InitializeIfNeeded(16000, -1, 1),
42 "dst_sample_rate_hz");
43}
44
45TEST(PushResamplerTest, VerifiesBadInputParameters3) {
46 PushResampler<int16_t> resampler;
47 EXPECT_DEATH(resampler.InitializeIfNeeded(16000, 16000, 0), "num_channels");
48}
49
Tommif9d2fe92016-05-26 22:21:31 +020050#endif
Tommi0ad72ea2016-05-26 23:07:40 +020051#endif
Tommif9d2fe92016-05-26 22:21:31 +020052
andrew@webrtc.org50b2efe2013-04-29 17:27:29 +000053} // namespace webrtc