diff options
author | nkmakarov <nkmakarov@yandex-team.ru> | 2022-02-10 16:49:06 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:06 +0300 |
commit | 324348a37ed08cf66897faefb0ec4bebfe7804e1 (patch) | |
tree | 8736a3afd6953763bf57544746bf1b8b5404dec6 /library/cpp/getopt | |
parent | 5eddcf9f19515e4be1e49ba1482d920e007a07d1 (diff) | |
download | ydb-324348a37ed08cf66897faefb0ec4bebfe7804e1.tar.gz |
Restoring authorship annotation for <nkmakarov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/getopt')
-rw-r--r-- | library/cpp/getopt/small/modchooser.cpp | 2 | ||||
-rw-r--r-- | library/cpp/getopt/ut/modchooser_ut.cpp | 78 | ||||
-rw-r--r-- | library/cpp/getopt/ut/ya.make | 2 |
3 files changed, 41 insertions, 41 deletions
diff --git a/library/cpp/getopt/small/modchooser.cpp b/library/cpp/getopt/small/modchooser.cpp index 2fa5cfd070..020de1c9df 100644 --- a/library/cpp/getopt/small/modchooser.cpp +++ b/library/cpp/getopt/small/modchooser.cpp @@ -70,7 +70,7 @@ TModChooser::TMode::TMode(const TString& name, TMainClass* main, const TString& } TModChooser::TModChooser() - : ModesHelpOption("-?") // Default help option in last_getopt + : ModesHelpOption("-?") // Default help option in last_getopt , VersionHandler(nullptr) , ShowSeparated(true) , SvnRevisionOptionDisabled(false) diff --git a/library/cpp/getopt/ut/modchooser_ut.cpp b/library/cpp/getopt/ut/modchooser_ut.cpp index a14c8a5853..f756a4c8fb 100644 --- a/library/cpp/getopt/ut/modchooser_ut.cpp +++ b/library/cpp/getopt/ut/modchooser_ut.cpp @@ -1,9 +1,9 @@ #include <library/cpp/getopt/modchooser.h> - + #include <library/cpp/testing/unittest/registar.h> - -#include <util/stream/str.h> - + +#include <util/stream/str.h> + void ValidateArgcArgv(int argc, const char** argv) { UNIT_ASSERT_EQUAL(argc, 1); UNIT_ASSERT_EQUAL(argv[argc], nullptr); @@ -11,61 +11,61 @@ void ValidateArgcArgv(int argc, const char** argv) { int One(int argc, const char** argv) { ValidateArgcArgv(argc, argv); - return 1; -} - + return 1; +} + int Two(int argc, const char** argv) { ValidateArgcArgv(argc, argv); - return 2; -} - + return 2; +} + int Three(int argc, const char** argv) { ValidateArgcArgv(argc, argv); - return 3; -} - + return 3; +} + int Four(int argc, const char** argv) { ValidateArgcArgv(argc, argv); - return 4; -} - + return 4; +} + int Five(int argc, const char** argv) { ValidateArgcArgv(argc, argv); - return 5; -} - -typedef int (*F_PTR)(int, const char**); -static const F_PTR FUNCTIONS[] = {One, Two, Three, Four, Five}; -static const char* NAMES[] = {"one", "two", "three", "four", "five"}; + return 5; +} + +typedef int (*F_PTR)(int, const char**); +static const F_PTR FUNCTIONS[] = {One, Two, Three, Four, Five}; +static const char* NAMES[] = {"one", "two", "three", "four", "five"}; static_assert(Y_ARRAY_SIZE(FUNCTIONS) == Y_ARRAY_SIZE(NAMES), "Incorrect input tests data"); - + Y_UNIT_TEST_SUITE(TModChooserTest) { Y_UNIT_TEST(TestModesSimpleRunner) { - TModChooser chooser; + TModChooser chooser; for (size_t idx = 0; idx < Y_ARRAY_SIZE(NAMES); ++idx) { - chooser.AddMode(NAMES[idx], FUNCTIONS[idx], NAMES[idx]); - } - + chooser.AddMode(NAMES[idx], FUNCTIONS[idx], NAMES[idx]); + } + // test argc, argv for (size_t idx = 0; idx < Y_ARRAY_SIZE(NAMES); ++idx) { - int argc = 2; + int argc = 2; const char* argv[] = {"UNITTEST", NAMES[idx], nullptr}; - UNIT_ASSERT_EQUAL(static_cast<int>(idx) + 1, chooser.Run(argc, argv)); - } + UNIT_ASSERT_EQUAL(static_cast<int>(idx) + 1, chooser.Run(argc, argv)); + } // test TVector<TString> argv for (size_t idx = 0; idx < Y_ARRAY_SIZE(NAMES); ++idx) { const TVector<TString> argv = {"UNITTEST", NAMES[idx]}; UNIT_ASSERT_EQUAL(static_cast<int>(idx) + 1, chooser.Run(argv)); } - } - + } + Y_UNIT_TEST(TestHelpMessage) { - TModChooser chooser; - - int argc = 2; + TModChooser chooser; + + int argc = 2; const char* argv[] = {"UNITTEST", "-?", nullptr}; - - chooser.Run(argc, argv); - } -} + + chooser.Run(argc, argv); + } +} diff --git a/library/cpp/getopt/ut/ya.make b/library/cpp/getopt/ut/ya.make index 8d00669efb..2d3b4625e0 100644 --- a/library/cpp/getopt/ut/ya.make +++ b/library/cpp/getopt/ut/ya.make @@ -4,7 +4,7 @@ OWNER(pg) SRCS( last_getopt_ut.cpp - modchooser_ut.cpp + modchooser_ut.cpp opt2_ut.cpp opt_ut.cpp posix_getopt_ut.cpp |