Conversational Speech generator, adding unit test.
Test for the conversational_speech::Config class and renaming. BUG=webrtc:7218 Review-Url: https://codereview.webrtc.org/2749573002 Cr-Commit-Position: refs/heads/master@{#17301}
This commit is contained in:
parent
5f32aca85e
commit
3b51065c55
@ -6,26 +6,50 @@
|
||||
# in the file PATENTS. All contributing project authors may
|
||||
# be found in the AUTHORS file in the root of the source tree.
|
||||
|
||||
import("../../../../webrtc.gni")
|
||||
import("//webrtc/webrtc.gni")
|
||||
|
||||
group("conversational_speech") {
|
||||
testonly = true
|
||||
deps = [
|
||||
":convspeech_gen",
|
||||
":conversational_speech_generator",
|
||||
":conversational_speech_generator_unittest",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_executable("convspeech_gen") {
|
||||
rtc_executable("conversational_speech_generator") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"convspeech_gen.cc",
|
||||
"settings.cc",
|
||||
"settings.h",
|
||||
"generator.cc",
|
||||
]
|
||||
deps = [
|
||||
":lib",
|
||||
"//third_party/gflags",
|
||||
"//webrtc/base:rtc_base_approved",
|
||||
"//webrtc/test:test_support",
|
||||
]
|
||||
visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||
} # bin
|
||||
|
||||
rtc_static_library("lib") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"config.cc",
|
||||
"config.h",
|
||||
]
|
||||
deps = []
|
||||
visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||
} # lib
|
||||
|
||||
rtc_test("conversational_speech_generator_unittest") {
|
||||
testonly = true
|
||||
deps = [
|
||||
":lib",
|
||||
"//testing/gtest",
|
||||
"//webrtc//base:rtc_base_tests_main",
|
||||
"//webrtc/test:test_support",
|
||||
]
|
||||
sources = [
|
||||
"generator_unittest.cc",
|
||||
]
|
||||
visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||
}
|
||||
|
||||
@ -8,22 +8,24 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "webrtc/modules/audio_processing/test/conversational_speech/settings.h"
|
||||
#include "webrtc/modules/audio_processing/test/conversational_speech/config.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
namespace conversational_speech {
|
||||
|
||||
const std::string& ConvSpeechGeneratorSettings::audiotracks_path() const {
|
||||
const std::string& Config::audiotracks_path() const {
|
||||
return audiotracks_path_;
|
||||
}
|
||||
|
||||
const std::string& ConvSpeechGeneratorSettings::timing_filepath() const {
|
||||
const std::string& Config::timing_filepath() const {
|
||||
return timing_filepath_;
|
||||
}
|
||||
|
||||
const std::string& ConvSpeechGeneratorSettings::output_path() const {
|
||||
const std::string& Config::output_path() const {
|
||||
return output_path_;
|
||||
}
|
||||
|
||||
} // namespace conversational_speech
|
||||
} // namespace test
|
||||
} // namespace webrtc
|
||||
@ -8,18 +8,19 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_SETTINGS_H_
|
||||
#define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_SETTINGS_H_
|
||||
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_CONFIG_H_
|
||||
#define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_CONFIG_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
namespace conversational_speech {
|
||||
|
||||
struct ConvSpeechGeneratorSettings {
|
||||
ConvSpeechGeneratorSettings(const std::string& audiotracks_path,
|
||||
const std::string& timing_filepath,
|
||||
const std::string& output_path)
|
||||
struct Config {
|
||||
Config(const std::string& audiotracks_path,
|
||||
const std::string& timing_filepath,
|
||||
const std::string& output_path)
|
||||
: audiotracks_path_(audiotracks_path),
|
||||
timing_filepath_(timing_filepath),
|
||||
output_path_(output_path) {}
|
||||
@ -33,7 +34,8 @@ struct ConvSpeechGeneratorSettings {
|
||||
const std::string output_path_;
|
||||
};
|
||||
|
||||
} // namespace conversational_speech
|
||||
} // namespace test
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_SETTINGS_H_
|
||||
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_CONFIG_H_
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
#include "gflags/gflags.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/modules/audio_processing/test/conversational_speech/settings.h"
|
||||
#include "webrtc/modules/audio_processing/test/conversational_speech/config.h"
|
||||
#include "webrtc/test/testsupport/fileutils.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -28,7 +28,7 @@ auto file_exists = [](const char* c, const std::string& filepath) {
|
||||
};
|
||||
|
||||
const char kUsageDescription[] =
|
||||
"Usage: convspeech_gen\n"
|
||||
"Usage: conversational_speech_generator\n"
|
||||
" -i <path/to/source/audiotracks>\n"
|
||||
" -t <path/to/timing_file.txt>\n"
|
||||
" -o <output/path>\n"
|
||||
@ -49,13 +49,13 @@ int main(int argc, char* argv[]) {
|
||||
google::SetUsageMessage(kUsageDescription);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
ConvSpeechGeneratorSettings settings(FLAGS_i, FLAGS_t, FLAGS_o);
|
||||
conversational_speech::Config config(FLAGS_i, FLAGS_t, FLAGS_o);
|
||||
|
||||
// TODO(alessiob): remove line below once debugged.
|
||||
rtc::LogMessage::LogToDebug(rtc::LS_VERBOSE);
|
||||
LOG(LS_VERBOSE) << "i = " << settings.audiotracks_path();
|
||||
LOG(LS_VERBOSE) << "t = " << settings.timing_filepath();
|
||||
LOG(LS_VERBOSE) << "o = " << settings.output_path();
|
||||
LOG(LS_VERBOSE) << "i = " << config.audiotracks_path();
|
||||
LOG(LS_VERBOSE) << "t = " << config.timing_filepath();
|
||||
LOG(LS_VERBOSE) << "o = " << config.output_path();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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/conversational_speech/config.h"
|
||||
#include "webrtc/test/gtest.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
namespace {
|
||||
|
||||
const char* const audiotracks_path = "/path/to/audiotracks";
|
||||
const char* const timing_filepath = "/path/to/timing_file.txt";
|
||||
const char* const output_path = "/path/to/output_dir";
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST(ConversationalSpeechTest, Settings) {
|
||||
conversational_speech::Config config(
|
||||
audiotracks_path, timing_filepath, output_path);
|
||||
|
||||
// Test getters.
|
||||
EXPECT_EQ(config.audiotracks_path(), audiotracks_path);
|
||||
EXPECT_EQ(config.timing_filepath(), timing_filepath);
|
||||
EXPECT_EQ(config.output_path(), output_path);
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace webrtc
|
||||
Loading…
x
Reference in New Issue
Block a user