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}
diff --git a/webrtc/modules/audio_processing/test/conversational_speech/BUILD.gn b/webrtc/modules/audio_processing/test/conversational_speech/BUILD.gn
index 5301cb2..d0cb1e7 100644
--- a/webrtc/modules/audio_processing/test/conversational_speech/BUILD.gn
+++ b/webrtc/modules/audio_processing/test/conversational_speech/BUILD.gn
@@ -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.
}
diff --git a/webrtc/modules/audio_processing/test/conversational_speech/settings.cc b/webrtc/modules/audio_processing/test/conversational_speech/config.cc
similarity index 72%
rename from webrtc/modules/audio_processing/test/conversational_speech/settings.cc
rename to webrtc/modules/audio_processing/test/conversational_speech/config.cc
index 8b2e88b..5a0a322 100644
--- a/webrtc/modules/audio_processing/test/conversational_speech/settings.cc
+++ b/webrtc/modules/audio_processing/test/conversational_speech/config.cc
@@ -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
diff --git a/webrtc/modules/audio_processing/test/conversational_speech/settings.h b/webrtc/modules/audio_processing/test/conversational_speech/config.h
similarity index 79%
rename from webrtc/modules/audio_processing/test/conversational_speech/settings.h
rename to webrtc/modules/audio_processing/test/conversational_speech/config.h
index ea360b7..bad1145 100644
--- a/webrtc/modules/audio_processing/test/conversational_speech/settings.h
+++ b/webrtc/modules/audio_processing/test/conversational_speech/config.h
@@ -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 @@
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_
diff --git a/webrtc/modules/audio_processing/test/conversational_speech/convspeech_gen.cc b/webrtc/modules/audio_processing/test/conversational_speech/generator.cc
similarity index 86%
rename from webrtc/modules/audio_processing/test/conversational_speech/convspeech_gen.cc
rename to webrtc/modules/audio_processing/test/conversational_speech/generator.cc
index 2b88597..923736f 100644
--- a/webrtc/modules/audio_processing/test/conversational_speech/convspeech_gen.cc
+++ b/webrtc/modules/audio_processing/test/conversational_speech/generator.cc
@@ -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 @@
};
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 @@
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;
}
diff --git a/webrtc/modules/audio_processing/test/conversational_speech/generator_unittest.cc b/webrtc/modules/audio_processing/test/conversational_speech/generator_unittest.cc
new file mode 100644
index 0000000..da923bc
--- /dev/null
+++ b/webrtc/modules/audio_processing/test/conversational_speech/generator_unittest.cc
@@ -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