diff options
author | melkov <melkov@yandex-team.ru> | 2022-02-10 16:48:14 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:14 +0300 |
commit | 2c532b38e6aeb4fd88531027c7335690fd34c4e5 (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp/getopt/ut/opt2_ut.cpp | |
parent | 438546c8737d5c1fdeb31157dcf999717d930eec (diff) | |
download | ydb-2c532b38e6aeb4fd88531027c7335690fd34c4e5.tar.gz |
Restoring authorship annotation for <melkov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/getopt/ut/opt2_ut.cpp')
-rw-r--r-- | library/cpp/getopt/ut/opt2_ut.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/library/cpp/getopt/ut/opt2_ut.cpp b/library/cpp/getopt/ut/opt2_ut.cpp index 01ec1c8173..0e7464747c 100644 --- a/library/cpp/getopt/ut/opt2_ut.cpp +++ b/library/cpp/getopt/ut/opt2_ut.cpp @@ -2,11 +2,11 @@ #include <library/cpp/testing/unittest/registar.h> -//using namespace NLastGetopt; +//using namespace NLastGetopt; Y_UNIT_TEST_SUITE(Opt2Test) { Y_UNIT_TEST(TestSimple) { - int argc = 8; + int argc = 8; char* argv[] = { (char*)"cmd", (char*)"--aaaa=aaaa", @@ -18,7 +18,7 @@ Y_UNIT_TEST_SUITE(Opt2Test) { (char*)"ww", }; - Opt2 opt(argc, argv, "A:b:cd:e:x:", 2, "aaaa=A"); + Opt2 opt(argc, argv, "A:b:cd:e:x:", 2, "aaaa=A"); const char* edef = "edef"; const char* a = opt.Arg('A', "<var_name> - usage of -A"); @@ -33,31 +33,31 @@ Y_UNIT_TEST_SUITE(Opt2Test) { UNIT_ASSERT_VALUES_EQUAL(2, b); UNIT_ASSERT(c); UNIT_ASSERT_VALUES_EQUAL(8, d); - UNIT_ASSERT_VALUES_EQUAL((void*)edef, e); + UNIT_ASSERT_VALUES_EQUAL((void*)edef, e); UNIT_ASSERT_VALUES_EQUAL(2u, opt.Pos.size()); UNIT_ASSERT_STRINGS_EQUAL("zz", opt.Pos.at(0)); - UNIT_ASSERT_VALUES_EQUAL((void*)argv[2], opt.Pos.at(0)); + UNIT_ASSERT_VALUES_EQUAL((void*)argv[2], opt.Pos.at(0)); UNIT_ASSERT_STRINGS_EQUAL("ww", opt.Pos.at(1)); - UNIT_ASSERT_STRINGS_EQUAL("1", x.at(0)); - UNIT_ASSERT_STRINGS_EQUAL("2", x.at(1)); + UNIT_ASSERT_STRINGS_EQUAL("1", x.at(0)); + UNIT_ASSERT_STRINGS_EQUAL("2", x.at(1)); } - + Y_UNIT_TEST(TestErrors1) { - int argc = 4; - char* argv[] = { + int argc = 4; + char* argv[] = { (char*)"cmd", (char*)"zz", (char*)"-c", (char*)"-e", - }; - - Opt2 opt(argc, argv, "ce:", 2); - + }; + + Opt2 opt(argc, argv, "ce:", 2); + const char* edef = "edef"; bool c = opt.Has('c', "usage of -c"); const char* e = opt.Arg('e', "<unused> - only default is really used", edef); - UNIT_ASSERT(c); - UNIT_ASSERT_VALUES_EQUAL((void*)edef, e); - } + UNIT_ASSERT(c); + UNIT_ASSERT_VALUES_EQUAL((void*)edef, e); + } } |