2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
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.
11 // Unit tests for Accelerate and PreemptiveExpand classes.
13 #include "webrtc/modules/audio_coding/neteq/accelerate.h"
14 #include "webrtc/modules/audio_coding/neteq/preemptive_expand.h"
16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "webrtc/modules/audio_coding/neteq/background_noise.h"
21 TEST(TimeStretch, CreateAndDestroy) {
22 const int kSampleRate = 8000;
23 const size_t kNumChannels = 1;
24 const int kOverlapSamples = 5 * kSampleRate / 8000;
25 BackgroundNoise bgn(kNumChannels);
26 Accelerate accelerate(kSampleRate, kNumChannels, bgn);
27 PreemptiveExpand preemptive_expand(
28 kSampleRate, kNumChannels, bgn, kOverlapSamples);
31 TEST(TimeStretch, CreateUsingFactory) {
32 const int kSampleRate = 8000;
33 const size_t kNumChannels = 1;
34 const int kOverlapSamples = 5 * kSampleRate / 8000;
35 BackgroundNoise bgn(kNumChannels);
37 AccelerateFactory accelerate_factory;
38 Accelerate* accelerate =
39 accelerate_factory.Create(kSampleRate, kNumChannels, bgn);
40 EXPECT_TRUE(accelerate != NULL);
43 PreemptiveExpandFactory preemptive_expand_factory;
44 PreemptiveExpand* preemptive_expand = preemptive_expand_factory.Create(
45 kSampleRate, kNumChannels, bgn, kOverlapSamples);
46 EXPECT_TRUE(preemptive_expand != NULL);
47 delete preemptive_expand;
50 // TODO(hlundin): Write more tests.