push_resampler_unittest.cc (1493B)
1 /* 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 11 #include "common_audio/resampler/include/push_resampler.h" 12 13 #include <cstdint> 14 15 #include "rtc_base/checks.h" // RTC_DCHECK_IS_ON 16 #include "test/gtest.h" 17 #include "test/testsupport/rtc_expect_death.h" 18 19 // Quality testing of PushResampler is done in audio/remix_resample_unittest.cc. 20 21 namespace webrtc { 22 23 TEST(PushResamplerTest, VerifiesInputParameters) { 24 PushResampler<int16_t> resampler1(160, 160, 1); 25 PushResampler<int16_t> resampler2(160, 160, 2); 26 PushResampler<int16_t> resampler3(160, 160, 8); 27 } 28 29 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) 30 TEST(PushResamplerDeathTest, VerifiesBadInputParameters1) { 31 RTC_EXPECT_DEATH(PushResampler<int16_t>(-1, 160, 1), 32 "src_samples_per_channel"); 33 } 34 35 TEST(PushResamplerDeathTest, VerifiesBadInputParameters2) { 36 RTC_EXPECT_DEATH(PushResampler<int16_t>(160, -1, 1), 37 "dst_samples_per_channel"); 38 } 39 40 TEST(PushResamplerDeathTest, VerifiesBadInputParameters3) { 41 RTC_EXPECT_DEATH(PushResampler<int16_t>(160, 16000, 0), "num_channels"); 42 } 43 #endif 44 45 } // namespace webrtc