vad_unittest.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2012 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. #ifndef COMMON_AUDIO_VAD_VAD_UNITTEST_H_
  11. #define COMMON_AUDIO_VAD_VAD_UNITTEST_H_
  12. #include <stddef.h> // size_t
  13. #include "test/gtest.h"
  14. namespace webrtc {
  15. namespace test {
  16. // Modes we support
  17. const int kModes[] = {0, 1, 2, 3};
  18. const size_t kModesSize = sizeof(kModes) / sizeof(*kModes);
  19. // Rates we support.
  20. const int kRates[] = {8000, 12000, 16000, 24000, 32000, 48000};
  21. const size_t kRatesSize = sizeof(kRates) / sizeof(*kRates);
  22. // Frame lengths we support.
  23. const size_t kMaxFrameLength = 1440;
  24. const size_t kFrameLengths[] = {
  25. 80, 120, 160, 240, 320, 480, 640, 960, kMaxFrameLength};
  26. const size_t kFrameLengthsSize = sizeof(kFrameLengths) / sizeof(*kFrameLengths);
  27. } // namespace test
  28. } // namespace webrtc
  29. class VadTest : public ::testing::Test {
  30. protected:
  31. VadTest();
  32. void SetUp() override;
  33. void TearDown() override;
  34. // Returns true if the rate and frame length combination is valid.
  35. bool ValidRatesAndFrameLengths(int rate, size_t frame_length);
  36. };
  37. #endif // COMMON_AUDIO_VAD_VAD_UNITTEST_H_