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 | f1803fa4ac9e2ee6cbfde317571ec330013392ff (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/getopt/ut | |
parent | 324348a37ed08cf66897faefb0ec4bebfe7804e1 (diff) | |
download | ydb-f1803fa4ac9e2ee6cbfde317571ec330013392ff.tar.gz |
Restoring authorship annotation for <nkmakarov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/getopt/ut')
-rw-r--r-- | library/cpp/getopt/ut/modchooser_ut.cpp | 78 | ||||
-rw-r--r-- | library/cpp/getopt/ut/ya.make | 2 |
2 files changed, 40 insertions, 40 deletions
diff --git a/library/cpp/getopt/ut/modchooser_ut.cpp b/library/cpp/getopt/ut/modchooser_ut.cpp index f756a4c8fb..a14c8a5853 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 2d3b4625e0..8d00669efb 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 |