Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: webrtc/tools/simple_command_line_parser_unittest.cc

Issue 2965593002: Move webrtc/{tools => rtc_tools} (Closed)
Patch Set: Adding back root changes Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/tools/simple_command_line_parser.cc ('k') | webrtc/tools/testing/README.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/tools/simple_command_line_parser_unittest.cc
diff --git a/webrtc/tools/simple_command_line_parser_unittest.cc b/webrtc/tools/simple_command_line_parser_unittest.cc
deleted file mode 100644
index 739ce83ae120dbda0324237e2d6dabb45e563eda..0000000000000000000000000000000000000000
--- a/webrtc/tools/simple_command_line_parser_unittest.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2012 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/test/gtest.h"
-#include "webrtc/tools/simple_command_line_parser.h"
-
-namespace webrtc {
-namespace test {
-
-class CommandLineParserTest : public ::testing::Test {
- protected:
- void SetUp() override {
- parser_ = new CommandLineParser();
-
- test_flags_length_ = 3;
- int flag_size = 32;
- test_flags_ = new char*[test_flags_length_];
- for (int i = 0; i < test_flags_length_; ++i) {
- test_flags_[i] = new char[flag_size];
- }
- strncpy(test_flags_[0], "tools_unittest", flag_size);
- strncpy(test_flags_[1], "--foo", flag_size);
- strncpy(test_flags_[2], "--bar=1", flag_size);
- }
- void TearDown() override {
- for (int i = 0; i < test_flags_length_; ++i) {
- delete[] test_flags_[i];
- }
- delete[] test_flags_;
- delete parser_;
- }
- CommandLineParser* parser_;
- // Test flags to emulate a program's argv arguments.
- char** test_flags_;
- int test_flags_length_;
-};
-
-TEST_F(CommandLineParserTest, ProcessFlags) {
- // Setup supported flags to parse.
- parser_->SetFlag("foo", "false");
- parser_->SetFlag("foo-foo", "false"); // To test boolean flags defaults.
- parser_->SetFlag("bar", "222");
- parser_->SetFlag("baz", "333"); // To test the default value functionality.
-
- parser_->Init(test_flags_length_, test_flags_);
- parser_->ProcessFlags();
- EXPECT_EQ("true", parser_->GetFlag("foo"));
- EXPECT_EQ("false", parser_->GetFlag("foo-foo"));
- EXPECT_EQ("1", parser_->GetFlag("bar"));
- EXPECT_EQ("333", parser_->GetFlag("baz"));
- EXPECT_EQ("", parser_->GetFlag("unknown"));
-}
-
-TEST_F(CommandLineParserTest, IsStandaloneFlag) {
- EXPECT_TRUE(parser_->IsStandaloneFlag("--foo"));
- EXPECT_TRUE(parser_->IsStandaloneFlag("--foo-foo"));
- EXPECT_FALSE(parser_->IsStandaloneFlag("--foo=1"));
-}
-
-TEST_F(CommandLineParserTest, IsFlagWellFormed) {
- EXPECT_TRUE(parser_->IsFlagWellFormed("--foo"));
- EXPECT_TRUE(parser_->IsFlagWellFormed("--foo-foo"));
- EXPECT_TRUE(parser_->IsFlagWellFormed("--bar=1"));
-}
-
-TEST_F(CommandLineParserTest, GetCommandLineFlagName) {
- EXPECT_EQ("foo", parser_->GetCommandLineFlagName("--foo"));
- EXPECT_EQ("foo-foo", parser_->GetCommandLineFlagName("--foo-foo"));
- EXPECT_EQ("bar", parser_->GetCommandLineFlagName("--bar=1"));
-}
-
-TEST_F(CommandLineParserTest, GetCommandLineFlagValue) {
- EXPECT_EQ("", parser_->GetCommandLineFlagValue("--foo"));
- EXPECT_EQ("", parser_->GetCommandLineFlagValue("--foo-foo"));
- EXPECT_EQ("1", parser_->GetCommandLineFlagValue("--bar=1"));
-}
-
-} // namespace test
-} // namespace webrtc
« no previous file with comments | « webrtc/tools/simple_command_line_parser.cc ('k') | webrtc/tools/testing/README.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698