diff options
author | Nikita Slyusarev <nslus@yandex-team.com> | 2022-02-10 16:46:53 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:53 +0300 |
commit | 469afdc4e2587bf62ecdd096b75a0baa444c4012 (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /util | |
parent | cd77cecfc03a3eaf87816af28a33067c4f0cdb59 (diff) | |
download | ydb-469afdc4e2587bf62ecdd096b75a0baa444c4012.tar.gz |
Restoring authorship annotation for Nikita Slyusarev <nslus@yandex-team.com>. Commit 2 of 2.
Diffstat (limited to 'util')
47 files changed, 570 insertions, 570 deletions
diff --git a/util/charset/benchmark/to_lower/metrics/ya.make b/util/charset/benchmark/to_lower/metrics/ya.make index 3bec63360e..5bb3461a8d 100644 --- a/util/charset/benchmark/to_lower/metrics/ya.make +++ b/util/charset/benchmark/to_lower/metrics/ya.make @@ -14,8 +14,8 @@ TAG( ya:fat ) -TEST_SRCS(main.py) +TEST_SRCS(main.py) -DEPENDS(util/charset/benchmark/to_lower) +DEPENDS(util/charset/benchmark/to_lower) END() diff --git a/util/charset/benchmark/to_lower/ya.make b/util/charset/benchmark/to_lower/ya.make index 900e6790d1..74c47e6de5 100644 --- a/util/charset/benchmark/to_lower/ya.make +++ b/util/charset/benchmark/to_lower/ya.make @@ -1,4 +1,4 @@ -OWNER(yazevnul) +OWNER(yazevnul) Y_BENCHMARK() diff --git a/util/charset/benchmark/utf8_to_wide/metrics/ya.make b/util/charset/benchmark/utf8_to_wide/metrics/ya.make index 941ab08442..c406e25bee 100644 --- a/util/charset/benchmark/utf8_to_wide/metrics/ya.make +++ b/util/charset/benchmark/utf8_to_wide/metrics/ya.make @@ -14,8 +14,8 @@ TAG( ya:fat ) -TEST_SRCS(main.py) +TEST_SRCS(main.py) -DEPENDS(util/charset/benchmark/utf8_to_wide) +DEPENDS(util/charset/benchmark/utf8_to_wide) END() diff --git a/util/charset/unidata.h b/util/charset/unidata.h index 108776c27b..400d314186 100644 --- a/util/charset/unidata.h +++ b/util/charset/unidata.h @@ -352,9 +352,9 @@ inline bool IsLower(wchar32 ch) { inline bool IsUpper(wchar32 ch) { return NUnicode::CharHasType(ch, SHIFT(Lu_UPPER)); } -inline bool IsTitle(wchar32 ch) { - return NUnicode::CharHasType(ch, SHIFT(Lt_TITLE)); -} +inline bool IsTitle(wchar32 ch) { + return NUnicode::CharHasType(ch, SHIFT(Lt_TITLE)); +} inline bool IsAlpha(wchar32 ch) { return NUnicode::CharHasType(ch, SHIFT(Lu_UPPER) | SHIFT(Ll_LOWER) | SHIFT(Lt_TITLE) | SHIFT(Lm_LETTER) | SHIFT(Lm_EXTENDER) | diff --git a/util/charset/ya.make b/util/charset/ya.make index 03413fd59f..26d38cb10b 100644 --- a/util/charset/ya.make +++ b/util/charset/ya.make @@ -22,10 +22,10 @@ JOIN_SRCS( IF (ARCH_X86_64 AND NOT DISABLE_INSTRUCTION_SETS) SRC_CPP_SSE41(wide_sse41.cpp) ELSE() - SRC( - wide_sse41.cpp - -DSSE41_STUB - ) + SRC( + wide_sse41.cpp + -DSSE41_STUB + ) ENDIF() END() diff --git a/util/draft/ut/ya.make b/util/draft/ut/ya.make index 75c3073a39..37ab9413c5 100644 --- a/util/draft/ut/ya.make +++ b/util/draft/ut/ya.make @@ -5,10 +5,10 @@ SUBSCRIBER(g:util-subscribers) SRCDIR(util/draft) -PEERDIR( - util/draft -) - +PEERDIR( + util/draft +) + SRCS( date_ut.cpp datetime_ut.cpp diff --git a/util/folder/dirut.cpp b/util/folder/dirut.cpp index 793a95545b..ffc9b09f96 100644 --- a/util/folder/dirut.cpp +++ b/util/folder/dirut.cpp @@ -563,7 +563,7 @@ int ResolvePath(const char* rel, const char* abs, char res[/*MAXPATHLEN*/], bool *res = 0; if (!rel || !*rel) return EINVAL; - if (!IsAbsolutePath(rel) && IsAbsolutePath(abs)) { + if (!IsAbsolutePath(rel) && IsAbsolutePath(abs)) { len = strlcpy(t, abs, sizeof(t)); if (len >= sizeof(t) - 3) return EINVAL; @@ -581,13 +581,13 @@ int ResolvePath(const char* rel, const char* abs, char res[/*MAXPATHLEN*/], bool } if (!realpath(t, res)) { if (!isdir && realpath(GetDirName(t).data(), res)) { - len = strlen(res); - if (res[len - 1] != LOCSLASH_C) { - res[len++] = LOCSLASH_C; - res[len] = 0; + len = strlen(res); + if (res[len - 1] != LOCSLASH_C) { + res[len++] = LOCSLASH_C; + res[len] = 0; } strcpy(res + len, GetBaseName(t).data()); - return 0; + return 0; } return errno ? errno : ENOENT; } diff --git a/util/folder/dirut.h b/util/folder/dirut.h index f7871a110a..2537027b12 100644 --- a/util/folder/dirut.h +++ b/util/folder/dirut.h @@ -67,7 +67,7 @@ inline TString GetFileNameComponent(const TString& f) { return GetFileNameComponent(f.data()); } -/// RealPath doesn't guarantee trailing separator to be stripped or left in place for directories. +/// RealPath doesn't guarantee trailing separator to be stripped or left in place for directories. TString RealPath(const TString& path); // throws TString RealLocation(const TString& path); /// throws; last file name component doesn't need to exist diff --git a/util/folder/dirut_ut.cpp b/util/folder/dirut_ut.cpp index cfe19f5482..45ebfc842c 100644 --- a/util/folder/dirut_ut.cpp +++ b/util/folder/dirut_ut.cpp @@ -4,8 +4,8 @@ #include <library/cpp/testing/unittest/registar.h> #include <util/generic/string.h> -#include <util/memory/tempbuf.h> -#include <util/stream/file.h> +#include <util/memory/tempbuf.h> +#include <util/stream/file.h> #include <util/system/platform.h> Y_UNIT_TEST_SUITE(TDirutTest) { @@ -15,18 +15,18 @@ Y_UNIT_TEST_SUITE(TDirutTest) { Y_UNIT_TEST(TestRealLocation) { UNIT_ASSERT(IsDir(RealLocation("."))); - + TTempDir tempDir; TString base = RealPath(tempDir()); UNIT_ASSERT(!base.empty()); - + if (base.back() == GetDirectorySeparator()) { base.pop_back(); } - + TString path; TString pathNotNorm; - + path = base + GetDirectorySeparatorS() + "no_such_file"; UNIT_ASSERT(NFs::Exists(GetDirName(path))); UNIT_ASSERT(!NFs::Exists(path)); @@ -34,16 +34,16 @@ Y_UNIT_TEST_SUITE(TDirutTest) { UNIT_ASSERT(NFs::Exists(GetDirName(path))); UNIT_ASSERT(!NFs::Exists(path)); UNIT_ASSERT_EQUAL(GetDirName(path), base); - + pathNotNorm = base + GetDirectorySeparatorS() + "some_dir" + GetDirectorySeparatorS() + ".." + GetDirectorySeparatorS() + "no_such_file"; MakeDirIfNotExist((base + GetDirectorySeparatorS() + "some_dir").data()); pathNotNorm = RealLocation(pathNotNorm); UNIT_ASSERT(NFs::Exists(GetDirName(pathNotNorm))); UNIT_ASSERT(!NFs::Exists(pathNotNorm)); UNIT_ASSERT_EQUAL(GetDirName(pathNotNorm), base); - + UNIT_ASSERT_EQUAL(path, pathNotNorm); - + path = base + GetDirectorySeparatorS() + "file"; { TFixedBufferFileOutput file(path); @@ -55,8 +55,8 @@ Y_UNIT_TEST_SUITE(TDirutTest) { UNIT_ASSERT(NFs::Exists(GetDirName(path))); UNIT_ASSERT(NFs::Exists(path)); UNIT_ASSERT_EQUAL(GetDirName(path), base); - } - + } + void DoTest(const char* p, const char* base, const char* canon) { TString path(p); UNIT_ASSERT(resolvepath(path, base)); @@ -106,24 +106,24 @@ Y_UNIT_TEST_SUITE(TDirutTest) { path = base + GetDirectorySeparatorS() + "nofile"; ResolvePath("nofile", base.data(), tempBuf.Data(), false); UNIT_ASSERT_EQUAL(tempBuf.Data(), path); - } - + } + Y_UNIT_TEST(TestGetDirName) { UNIT_ASSERT_VALUES_EQUAL(".", GetDirName("parambambam")); - } - + } + Y_UNIT_TEST(TestStripFileComponent) { static const TString tmpDir = "tmp_dir_for_tests"; static const TString tmpSubDir = tmpDir + GetDirectorySeparatorS() + "subdir"; static const TString tmpFile = tmpDir + GetDirectorySeparatorS() + "file"; - + // creating tmp dir and subdirs MakeDirIfNotExist(tmpDir.data()); MakeDirIfNotExist(tmpSubDir.data()); { TFixedBufferFileOutput file(tmpFile); } - + UNIT_ASSERT_EQUAL(StripFileComponent(tmpDir), tmpDir + GetDirectorySeparatorS()); UNIT_ASSERT_EQUAL(StripFileComponent(tmpSubDir), tmpSubDir + GetDirectorySeparatorS()); UNIT_ASSERT_EQUAL(StripFileComponent(tmpFile), tmpDir + GetDirectorySeparatorS()); diff --git a/util/folder/path.h b/util/folder/path.h index c98501fa35..2fb4d6b4ef 100644 --- a/util/folder/path.h +++ b/util/folder/path.h @@ -15,10 +15,10 @@ #include <utility> -/** - * Class behaviour is platform-dependent. - * It uses platform-dependent separators for path-reconstructing operations. - */ +/** + * Class behaviour is platform-dependent. + * It uses platform-dependent separators for path-reconstructing operations. + */ class TFsPath { private: struct TSplit; diff --git a/util/folder/path_ut.cpp b/util/folder/path_ut.cpp index 7b718deabc..e6a3451016 100644 --- a/util/folder/path_ut.cpp +++ b/util/folder/path_ut.cpp @@ -87,19 +87,19 @@ Y_UNIT_TEST_SUITE(TFsPathTests) { } Y_UNIT_TEST(Parent) { -#ifdef _win_ +#ifdef _win_ UNIT_ASSERT_VALUES_EQUAL(TFsPath("\\etc/passwd").Parent(), TFsPath("\\etc")); UNIT_ASSERT_VALUES_EQUAL(TFsPath("\\etc").Parent(), TFsPath("\\")); UNIT_ASSERT_VALUES_EQUAL(TFsPath("\\").Parent(), TFsPath("\\")); - + UNIT_ASSERT_VALUES_EQUAL(TFsPath("etc\\passwd").Parent(), TFsPath("etc")); UNIT_ASSERT_VALUES_EQUAL(TFsPath("etc").Parent(), TFsPath(".")); UNIT_ASSERT_VALUES_EQUAL(TFsPath(".\\etc").Parent(), TFsPath(".")); - + UNIT_ASSERT_VALUES_EQUAL(TFsPath("C:\\etc/passwd").Parent(), TFsPath("C:\\etc")); UNIT_ASSERT_VALUES_EQUAL(TFsPath("C:\\etc").Parent(), TFsPath("C:\\")); UNIT_ASSERT_VALUES_EQUAL(TFsPath("C:\\").Parent(), TFsPath("C:\\")); -#else +#else UNIT_ASSERT_VALUES_EQUAL(TFsPath("/etc/passwd").Parent(), TFsPath("/etc")); UNIT_ASSERT_VALUES_EQUAL(TFsPath("/etc").Parent(), TFsPath("/")); UNIT_ASSERT_VALUES_EQUAL(TFsPath("/").Parent(), TFsPath("/")); @@ -107,7 +107,7 @@ Y_UNIT_TEST_SUITE(TFsPathTests) { UNIT_ASSERT_VALUES_EQUAL(TFsPath("etc/passwd").Parent(), TFsPath("etc")); UNIT_ASSERT_VALUES_EQUAL(TFsPath("etc").Parent(), TFsPath(".")); UNIT_ASSERT_VALUES_EQUAL(TFsPath("./etc").Parent(), TFsPath(".")); -#endif +#endif #if 0 UNIT_ASSERT_VALUES_EQUAL(TFsPath("./etc/passwd").Parent(), TFsPath("./etc")); @@ -194,37 +194,37 @@ Y_UNIT_TEST_SUITE(TFsPathTests) { TFsPath p("/db/BASE/primus121-025-1380131338//"); UNIT_ASSERT_VALUES_EQUAL(p.Basename(), TString("primus121-025-1380131338")); TFsPath testP = p / "test"; -#ifdef _win_ +#ifdef _win_ UNIT_ASSERT_VALUES_EQUAL(testP.GetPath(), "\\db\\BASE\\primus121-025-1380131338\\test"); -#else +#else UNIT_ASSERT_VALUES_EQUAL(testP.GetPath(), "/db/BASE/primus121-025-1380131338/test"); -#endif +#endif } Y_UNIT_TEST(TestSlashesAndBasenameWin) { - TFsPath p("\\db\\BASE\\primus121-025-1380131338\\\\"); - TFsPath testP = p / "test"; -#ifdef _win_ + TFsPath p("\\db\\BASE\\primus121-025-1380131338\\\\"); + TFsPath testP = p / "test"; +#ifdef _win_ UNIT_ASSERT_VALUES_EQUAL(p.Basename(), TString("primus121-025-1380131338")); UNIT_ASSERT_VALUES_EQUAL(testP.GetPath(), "\\db\\BASE\\primus121-025-1380131338\\test"); -#else +#else UNIT_ASSERT_VALUES_EQUAL(p.Basename(), TString("\\db\\BASE\\primus121-025-1380131338\\\\")); UNIT_ASSERT_VALUES_EQUAL(testP.GetPath(), "\\db\\BASE\\primus121-025-1380131338\\\\/test"); -#endif - } - +#endif + } + Y_UNIT_TEST(TestSlashesAndBasenameWinDrive) { - TFsPath p("C:\\db\\BASE\\primus121-025-1380131338\\\\"); - TFsPath testP = p / "test"; -#ifdef _win_ + TFsPath p("C:\\db\\BASE\\primus121-025-1380131338\\\\"); + TFsPath testP = p / "test"; +#ifdef _win_ UNIT_ASSERT_VALUES_EQUAL(p.Basename(), TString("primus121-025-1380131338")); UNIT_ASSERT_VALUES_EQUAL(testP.GetPath(), "C:\\db\\BASE\\primus121-025-1380131338\\test"); -#else +#else UNIT_ASSERT_VALUES_EQUAL(p.Basename(), TString("C:\\db\\BASE\\primus121-025-1380131338\\\\")); UNIT_ASSERT_VALUES_EQUAL(testP.GetPath(), "C:\\db\\BASE\\primus121-025-1380131338\\\\/test"); -#endif - } - +#endif + } + Y_UNIT_TEST(TestList) { TTestDirectory td("TestList-dir"); @@ -350,17 +350,17 @@ Y_UNIT_TEST_SUITE(TFsPathTests) { UNIT_ASSERT_VALUES_EQUAL(TFsPath(), TFsPath().Fix()); UNIT_ASSERT_VALUES_EQUAL(TFsPath() / TFsPath(), TFsPath()); -#ifdef _win_ +#ifdef _win_ UNIT_ASSERT_VALUES_EQUAL(TFsPath("a\\b"), TFsPath() / TString("a\\b")); UNIT_ASSERT_VALUES_EQUAL(TFsPath("a\\b"), "a\\b" / TFsPath()); UNIT_ASSERT_VALUES_EQUAL(TFsPath("\\a\\b"), TFsPath() / "\\a\\b"); UNIT_ASSERT_VALUES_EQUAL(TFsPath("\\a\\b"), "\\a\\b" / TFsPath()); -#else +#else UNIT_ASSERT_VALUES_EQUAL(TFsPath("a/b"), TFsPath() / TString("a/b")); UNIT_ASSERT_VALUES_EQUAL(TFsPath("a/b"), "a/b" / TFsPath()); UNIT_ASSERT_VALUES_EQUAL(TFsPath("/a/b"), TFsPath() / "/a/b"); UNIT_ASSERT_VALUES_EQUAL(TFsPath("/a/b"), "/a/b" / TFsPath()); -#endif +#endif UNIT_ASSERT_VALUES_EQUAL(TFsPath("."), TFsPath() / "."); UNIT_ASSERT_VALUES_EQUAL(TFsPath("."), "." / TFsPath()); @@ -380,11 +380,11 @@ Y_UNIT_TEST_SUITE(TFsPathTests) { UNIT_ASSERT(!TFsPath().IsSubpathOf("a/b")); UNIT_ASSERT(TFsPath().IsContainerOf("a/b")); UNIT_ASSERT(!TFsPath().IsContainerOf("/a/b")); -#ifdef _win_ +#ifdef _win_ UNIT_ASSERT_VALUES_EQUAL(TFsPath("a\\b").RelativeTo(TFsPath()), TFsPath("a\\b")); -#else +#else UNIT_ASSERT_VALUES_EQUAL(TFsPath("a/b").RelativeTo(TFsPath()), TFsPath("a/b")); -#endif +#endif UNIT_ASSERT(!TFsPath().Exists()); UNIT_ASSERT(!TFsPath().IsFile()); @@ -394,21 +394,21 @@ Y_UNIT_TEST_SUITE(TFsPathTests) { } Y_UNIT_TEST(TestJoinFsPaths) { -#ifdef _win_ - UNIT_ASSERT_VALUES_EQUAL(JoinFsPaths("a\\b", "c\\d"), "a\\b\\c\\d"); +#ifdef _win_ + UNIT_ASSERT_VALUES_EQUAL(JoinFsPaths("a\\b", "c\\d"), "a\\b\\c\\d"); UNIT_ASSERT_VALUES_EQUAL(JoinFsPaths("a\\b", "..\\c"), "a\\b\\..\\c"); UNIT_ASSERT_VALUES_EQUAL(JoinFsPaths("a\\b\\..\\c", "d"), "a\\c\\d"); UNIT_ASSERT_VALUES_EQUAL(JoinFsPaths("a", "b", "c", "d"), "a\\b\\c\\d"); UNIT_ASSERT_VALUES_EQUAL(JoinFsPaths("a\\b\\..\\c"), "a\\b\\..\\c"); UNIT_ASSERT_VALUES_EQUAL(JoinFsPaths("a\\b", ""), "a\\b"); -#else +#else UNIT_ASSERT_VALUES_EQUAL(JoinFsPaths("a/b", "c/d"), "a/b/c/d"); UNIT_ASSERT_VALUES_EQUAL(JoinFsPaths("a/b", "../c"), "a/b/../c"); UNIT_ASSERT_VALUES_EQUAL(JoinFsPaths("a/b/../c", "d"), "a/c/d"); UNIT_ASSERT_VALUES_EQUAL(JoinFsPaths("a", "b", "c", "d"), "a/b/c/d"); UNIT_ASSERT_VALUES_EQUAL(JoinFsPaths("a/b/../c"), "a/b/../c"); UNIT_ASSERT_VALUES_EQUAL(JoinFsPaths("a/b", ""), "a/b"); -#endif +#endif } Y_UNIT_TEST(TestStringCast) { diff --git a/util/folder/pathsplit.cpp b/util/folder/pathsplit.cpp index d69aaf8d94..81d439a727 100644 --- a/util/folder/pathsplit.cpp +++ b/util/folder/pathsplit.cpp @@ -1,7 +1,7 @@ #include "pathsplit.h" -#include "dirut.h" - +#include "dirut.h" + #include <util/stream/output.h> #include <util/generic/yexception.h> @@ -24,7 +24,7 @@ void TPathSplitTraitsUnix::DoParseFirstPart(const TStringBuf part) { } if (IsAbsolutePath(part)) { - IsAbsolute = true; + IsAbsolute = true; } DoParsePart(part); diff --git a/util/folder/pathsplit.h b/util/folder/pathsplit.h index 2b734722cd..d134338e35 100644 --- a/util/folder/pathsplit.h +++ b/util/folder/pathsplit.h @@ -3,7 +3,7 @@ #include <util/generic/vector.h> #include <util/generic/strbuf.h> #include <util/generic/string.h> -#include <util/string/ascii.h> +#include <util/string/ascii.h> //do not own any data struct TPathSplitStore: public TVector<TStringBuf> { @@ -23,7 +23,7 @@ protected: struct TPathSplitTraitsUnix: public TPathSplitStore { static constexpr char MainPathSep = '/'; - + inline TString Reconstruct() const { return DoReconstruct(TStringBuf("/")); } @@ -42,7 +42,7 @@ struct TPathSplitTraitsUnix: public TPathSplitStore { struct TPathSplitTraitsWindows: public TPathSplitStore { static constexpr char MainPathSep = '\\'; - + inline TString Reconstruct() const { return DoReconstruct(TStringBuf("\\")); } diff --git a/util/folder/pathsplit_ut.cpp b/util/folder/pathsplit_ut.cpp index d48187360b..0e97afd0d0 100644 --- a/util/folder/pathsplit_ut.cpp +++ b/util/folder/pathsplit_ut.cpp @@ -1,29 +1,29 @@ -// File includes itself to make multiple passes of its suites with different platform-dependent definitions - -#ifndef PS_INCLUDED -// Outer part - +// File includes itself to make multiple passes of its suites with different platform-dependent definitions + +#ifndef PS_INCLUDED +// Outer part + #include "pathsplit.h" - + #include <library/cpp/testing/unittest/registar.h> - + #define VAR(NAME) Y_CAT(NAME, __LINE__) - + #define PS_CHECK(input, ...) \ const char* VAR(model)[] = {"", __VA_ARGS__}; \ UNIT_ASSERT_EQUAL(input.size(), sizeof(VAR(model)) / sizeof(const char*) - 1); \ for (size_t n = 0; n < input.size(); ++n) { \ UNIT_ASSERT_STRINGS_EQUAL(input[n], VAR(model)[n + 1]); \ } - + #define PS_INCLUDED - + #define PSUF(NAME) NAME #define PSUF_LOCAL(NAME) NAME##Local #include __FILE__ #undef PSUF #undef PSUF_LOCAL - + #define PSUF(NAME) NAME##Unix #define PSUF_LOCAL(NAME) PSUF(NAME) #ifdef _win_ @@ -37,7 +37,7 @@ #endif #undef PSUF #undef PSUF_LOCAL - + #define PSUF(NAME) NAME##Windows #define PSUF_LOCAL(NAME) PSUF(NAME) #ifndef _win_ @@ -51,61 +51,61 @@ #endif #undef PSUF #undef PSUF_LOCAL - + #undef PS_INCLUDED - -#else -// Inner part - + +#else +// Inner part + #ifdef _win_ #define TRUE_ONLY_WIN true #else #define TRUE_ONLY_WIN false #endif - + Y_UNIT_TEST_SUITE(PSUF(PathSplit)) { Y_UNIT_TEST(Empty) { PSUF(TPathSplit) ps; - PS_CHECK(ps); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - } - + PS_CHECK(ps); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + } + Y_UNIT_TEST(Relative) { PSUF(TPathSplit) ps("some/usual/path"); - PS_CHECK(ps, "some", "usual", "path"); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - } - + PS_CHECK(ps, "some", "usual", "path"); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + } + Y_UNIT_TEST(Absolute) { PSUF(TPathSplit) ps("/some/usual/path"); - PS_CHECK(ps, "some", "usual", "path"); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); - } - + PS_CHECK(ps, "some", "usual", "path"); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); + } + Y_UNIT_TEST(Self) { PSUF(TPathSplit) ps("."); - PS_CHECK(ps, "."); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - } - + PS_CHECK(ps, "."); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + } + Y_UNIT_TEST(Parent) { PSUF(TPathSplit) ps(".."); - PS_CHECK(ps, ".."); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - } - + PS_CHECK(ps, ".."); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + } + Y_UNIT_TEST(Root) { PSUF(TPathSplit) ps("/"); - PS_CHECK(ps); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); - } - + PS_CHECK(ps); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); + } + Y_UNIT_TEST(Reconstruct) { PSUF(TPathSplit) ps("some/usual/path/../../other/././//path"); @@ -114,369 +114,369 @@ Y_UNIT_TEST_SUITE(PSUF(PathSplit)) { #else UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "some/other/path"); #endif - + ps = PSUF(TPathSplit)("/some/usual/path/../../other/././//path"); #ifdef _win_ UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "\\some\\other\\path"); #else UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "/some/other/path"); #endif - } - + } + Y_UNIT_TEST(ParseFirstPart) { PSUF(TPathSplit) ps; - ps.ParseFirstPart("some/usual/path"); - PS_CHECK(ps, "some", "usual", "path"); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - - ps = PSUF(TPathSplit)(); - ps.ParseFirstPart("/some/usual/path"); - PS_CHECK(ps, "some", "usual", "path"); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); - } - + ps.ParseFirstPart("some/usual/path"); + PS_CHECK(ps, "some", "usual", "path"); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + + ps = PSUF(TPathSplit)(); + ps.ParseFirstPart("/some/usual/path"); + PS_CHECK(ps, "some", "usual", "path"); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); + } + Y_UNIT_TEST(ParsePart) { PSUF(TPathSplit) ps("some/usual/path"); - ps.ParsePart("sub/path"); - PS_CHECK(ps, "some", "usual", "path", "sub", "path"); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - - ps = PSUF(TPathSplit)("some/usual/path"); - ps.ParsePart("/sub/path"); - PS_CHECK(ps, "some", "usual", "path", "sub", "path"); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - } - + ps.ParsePart("sub/path"); + PS_CHECK(ps, "some", "usual", "path", "sub", "path"); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + + ps = PSUF(TPathSplit)("some/usual/path"); + ps.ParsePart("/sub/path"); + PS_CHECK(ps, "some", "usual", "path", "sub", "path"); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + } + Y_UNIT_TEST(ParsePartSelf) { PSUF(TPathSplit) ps("some/usual/path"); - ps.ParsePart("."); - PS_CHECK(ps, "some", "usual", "path"); - - ps = PSUF(TPathSplit)("some/usual/path"); - ps.ParsePart("././."); - PS_CHECK(ps, "some", "usual", "path"); - } - + ps.ParsePart("."); + PS_CHECK(ps, "some", "usual", "path"); + + ps = PSUF(TPathSplit)("some/usual/path"); + ps.ParsePart("././."); + PS_CHECK(ps, "some", "usual", "path"); + } + Y_UNIT_TEST(ParsePartParent) { PSUF(TPathSplit) ps("some/usual/path"); - ps.ParsePart(".."); - PS_CHECK(ps, "some", "usual"); - - ps = PSUF(TPathSplit)("some/usual/path"); - ps.ParsePart("../.."); - PS_CHECK(ps, "some"); - - ps = PSUF(TPathSplit)("some/usual/path"); - ps.ParsePart("../../.."); - PS_CHECK(ps); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - - ps = PSUF(TPathSplit)("/some/usual/path"); - ps.ParsePart("../../.."); - PS_CHECK(ps); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); - } - + ps.ParsePart(".."); + PS_CHECK(ps, "some", "usual"); + + ps = PSUF(TPathSplit)("some/usual/path"); + ps.ParsePart("../.."); + PS_CHECK(ps, "some"); + + ps = PSUF(TPathSplit)("some/usual/path"); + ps.ParsePart("../../.."); + PS_CHECK(ps); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + + ps = PSUF(TPathSplit)("/some/usual/path"); + ps.ParsePart("../../.."); + PS_CHECK(ps); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); + } + Y_UNIT_TEST(ParsePartOverflow) { PSUF(TPathSplit) ps("some/usual/path"); - ps.ParsePart("../../../../.."); - PS_CHECK(ps, "..", ".."); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - - ps = PSUF(TPathSplit)("/some/usual/path"); - ps.ParsePart("../../../../.."); - PS_CHECK(ps, "..", ".."); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); - } - + ps.ParsePart("../../../../.."); + PS_CHECK(ps, "..", ".."); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + + ps = PSUF(TPathSplit)("/some/usual/path"); + ps.ParsePart("../../../../.."); + PS_CHECK(ps, "..", ".."); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); + } + Y_UNIT_TEST(WinRelative) { PSUF(TPathSplit) ps("some\\usual\\path"); #ifdef _win_ - PS_CHECK(ps, "some", "usual", "path"); + PS_CHECK(ps, "some", "usual", "path"); #else - PS_CHECK(ps, "some\\usual\\path"); + PS_CHECK(ps, "some\\usual\\path"); #endif - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - } - + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + } + Y_UNIT_TEST(WinAbsolute) { PSUF(TPathSplit) ps("\\some\\usual\\path"); #ifdef _win_ - PS_CHECK(ps, "some", "usual", "path"); + PS_CHECK(ps, "some", "usual", "path"); #else - PS_CHECK(ps, "\\some\\usual\\path"); + PS_CHECK(ps, "\\some\\usual\\path"); #endif - UNIT_ASSERT_EQUAL(ps.IsAbsolute, TRUE_ONLY_WIN); - + UNIT_ASSERT_EQUAL(ps.IsAbsolute, TRUE_ONLY_WIN); + PSUF(TPathSplit) psDrive("C:\\some\\usual\\path"); #ifdef _win_ - PS_CHECK(psDrive, "some", "usual", "path"); - UNIT_ASSERT_EQUAL(psDrive.Drive, "C:"); + PS_CHECK(psDrive, "some", "usual", "path"); + UNIT_ASSERT_EQUAL(psDrive.Drive, "C:"); #else - PS_CHECK(psDrive, "C:\\some\\usual\\path"); + PS_CHECK(psDrive, "C:\\some\\usual\\path"); #endif - UNIT_ASSERT_EQUAL(psDrive.IsAbsolute, TRUE_ONLY_WIN); - + UNIT_ASSERT_EQUAL(psDrive.IsAbsolute, TRUE_ONLY_WIN); + PSUF(TPathSplit) psDrive2("C:/some/usual/path"); #ifdef _win_ - PS_CHECK(psDrive2, "some", "usual", "path"); - UNIT_ASSERT_EQUAL(psDrive2.Drive, "C:"); + PS_CHECK(psDrive2, "some", "usual", "path"); + UNIT_ASSERT_EQUAL(psDrive2.Drive, "C:"); #else - PS_CHECK(psDrive2, "C:", "some", "usual", "path"); + PS_CHECK(psDrive2, "C:", "some", "usual", "path"); #endif - UNIT_ASSERT_EQUAL(psDrive2.IsAbsolute, TRUE_ONLY_WIN); - } - + UNIT_ASSERT_EQUAL(psDrive2.IsAbsolute, TRUE_ONLY_WIN); + } + Y_UNIT_TEST(WinRoot) { PSUF(TPathSplit) ps("\\"); #ifdef _win_ - PS_CHECK(ps); + PS_CHECK(ps); #else - PS_CHECK(ps, "\\"); + PS_CHECK(ps, "\\"); #endif - UNIT_ASSERT_EQUAL(ps.IsAbsolute, TRUE_ONLY_WIN); - + UNIT_ASSERT_EQUAL(ps.IsAbsolute, TRUE_ONLY_WIN); + PSUF(TPathSplit) psDrive("C:"); #ifdef _win_ - PS_CHECK(psDrive); - UNIT_ASSERT_EQUAL(psDrive.Drive, "C:"); + PS_CHECK(psDrive); + UNIT_ASSERT_EQUAL(psDrive.Drive, "C:"); #else - PS_CHECK(psDrive, "C:"); + PS_CHECK(psDrive, "C:"); #endif - UNIT_ASSERT_EQUAL(psDrive.IsAbsolute, TRUE_ONLY_WIN); - } - + UNIT_ASSERT_EQUAL(psDrive.IsAbsolute, TRUE_ONLY_WIN); + } + Y_UNIT_TEST(WinReconstruct) { PSUF(TPathSplit) ps("some\\usual\\path\\..\\..\\other\\.\\.\\\\\\path"); #ifdef _win_ - UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "some\\other\\path"); + UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "some\\other\\path"); #else - UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "some\\usual\\path\\..\\..\\other\\.\\.\\\\\\path"); + UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "some\\usual\\path\\..\\..\\other\\.\\.\\\\\\path"); #endif - - ps = PSUF(TPathSplit)("\\some\\usual\\path\\..\\..\\other\\.\\.\\\\\\path"); + + ps = PSUF(TPathSplit)("\\some\\usual\\path\\..\\..\\other\\.\\.\\\\\\path"); #ifdef _win_ - UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "\\some\\other\\path"); + UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "\\some\\other\\path"); #else - UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "\\some\\usual\\path\\..\\..\\other\\.\\.\\\\\\path"); + UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "\\some\\usual\\path\\..\\..\\other\\.\\.\\\\\\path"); #endif - } - + } + Y_UNIT_TEST(WinParseFirstPart) { PSUF(TPathSplit) ps; - ps.ParseFirstPart("some\\usual\\path"); + ps.ParseFirstPart("some\\usual\\path"); #ifdef _win_ - PS_CHECK(ps, "some", "usual", "path"); + PS_CHECK(ps, "some", "usual", "path"); #else - PS_CHECK(ps, "some\\usual\\path"); + PS_CHECK(ps, "some\\usual\\path"); #endif - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - - ps = PSUF(TPathSplit)(); - ps.ParseFirstPart("\\some\\usual\\path"); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + + ps = PSUF(TPathSplit)(); + ps.ParseFirstPart("\\some\\usual\\path"); #ifdef _win_ - PS_CHECK(ps, "some", "usual", "path"); + PS_CHECK(ps, "some", "usual", "path"); #else - PS_CHECK(ps, "\\some\\usual\\path"); + PS_CHECK(ps, "\\some\\usual\\path"); #endif - UNIT_ASSERT_EQUAL(ps.IsAbsolute, TRUE_ONLY_WIN); - } - + UNIT_ASSERT_EQUAL(ps.IsAbsolute, TRUE_ONLY_WIN); + } + Y_UNIT_TEST(WinParsePart) { PSUF(TPathSplit) ps("some\\usual\\path"); - ps.ParsePart("sub\\path"); + ps.ParsePart("sub\\path"); #ifdef _win_ - PS_CHECK(ps, "some", "usual", "path", "sub", "path"); + PS_CHECK(ps, "some", "usual", "path", "sub", "path"); #else - PS_CHECK(ps, "some\\usual\\path", "sub\\path"); + PS_CHECK(ps, "some\\usual\\path", "sub\\path"); #endif - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - - ps = PSUF(TPathSplit)("some\\usual\\path"); - ps.ParsePart("\\sub\\path"); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + + ps = PSUF(TPathSplit)("some\\usual\\path"); + ps.ParsePart("\\sub\\path"); #ifdef _win_ - PS_CHECK(ps, "some", "usual", "path", "sub", "path"); + PS_CHECK(ps, "some", "usual", "path", "sub", "path"); #else - PS_CHECK(ps, "some\\usual\\path", "\\sub\\path"); + PS_CHECK(ps, "some\\usual\\path", "\\sub\\path"); #endif - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - } - + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + } + #ifdef _win_ Y_UNIT_TEST(WinParsePartSelf) { PSUF(TPathSplit) ps("some\\usual\\path"); - ps.ParsePart("."); - PS_CHECK(ps, "some", "usual", "path"); - - ps = PSUF(TPathSplit)("some\\usual\\path"); - ps.ParsePart(".\\.\\."); - PS_CHECK(ps, "some", "usual", "path"); - } - + ps.ParsePart("."); + PS_CHECK(ps, "some", "usual", "path"); + + ps = PSUF(TPathSplit)("some\\usual\\path"); + ps.ParsePart(".\\.\\."); + PS_CHECK(ps, "some", "usual", "path"); + } + Y_UNIT_TEST(WinParsePartParent) { PSUF(TPathSplit) ps("some\\usual\\path"); - ps.ParsePart(".."); - PS_CHECK(ps, "some", "usual"); - - ps = PSUF(TPathSplit)("some\\usual\\path"); - ps.ParsePart("..\\.."); - PS_CHECK(ps, "some"); - - ps = PSUF(TPathSplit)("some\\usual\\path"); - ps.ParsePart("..\\..\\.."); - PS_CHECK(ps); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - - ps = PSUF(TPathSplit)("\\some\\usual\\path"); - ps.ParsePart("..\\..\\.."); - PS_CHECK(ps); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); - - ps = PSUF(TPathSplit)("C:\\some\\usual\\path"); - ps.ParsePart("..\\..\\.."); - PS_CHECK(ps); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); - UNIT_ASSERT_EQUAL(ps.Drive, "C:"); - } - + ps.ParsePart(".."); + PS_CHECK(ps, "some", "usual"); + + ps = PSUF(TPathSplit)("some\\usual\\path"); + ps.ParsePart("..\\.."); + PS_CHECK(ps, "some"); + + ps = PSUF(TPathSplit)("some\\usual\\path"); + ps.ParsePart("..\\..\\.."); + PS_CHECK(ps); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + + ps = PSUF(TPathSplit)("\\some\\usual\\path"); + ps.ParsePart("..\\..\\.."); + PS_CHECK(ps); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); + + ps = PSUF(TPathSplit)("C:\\some\\usual\\path"); + ps.ParsePart("..\\..\\.."); + PS_CHECK(ps); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); + UNIT_ASSERT_EQUAL(ps.Drive, "C:"); + } + Y_UNIT_TEST(WinParsePartOverflow) { PSUF(TPathSplit) ps("some\\usual\\path"); - ps.ParsePart("..\\..\\..\\..\\.."); - PS_CHECK(ps, "..", ".."); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - - ps = PSUF(TPathSplit)("\\some\\usual\\path"); - ps.ParsePart("..\\..\\..\\..\\.."); - PS_CHECK(ps, "..", ".."); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); - - ps = PSUF(TPathSplit)("C:\\some\\usual\\path"); - ps.ParsePart("..\\..\\..\\..\\.."); - PS_CHECK(ps, "..", ".."); - UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); - UNIT_ASSERT_EQUAL(ps.Drive, "C:"); - } + ps.ParsePart("..\\..\\..\\..\\.."); + PS_CHECK(ps, "..", ".."); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + + ps = PSUF(TPathSplit)("\\some\\usual\\path"); + ps.ParsePart("..\\..\\..\\..\\.."); + PS_CHECK(ps, "..", ".."); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); + + ps = PSUF(TPathSplit)("C:\\some\\usual\\path"); + ps.ParsePart("..\\..\\..\\..\\.."); + PS_CHECK(ps, "..", ".."); + UNIT_ASSERT_EQUAL(ps.IsAbsolute, true); + UNIT_ASSERT_EQUAL(ps.Drive, "C:"); + } #endif - + Y_UNIT_TEST(WinMixed) { PSUF(TPathSplit) ps("some\\usual/path"); #ifdef _win_ - PS_CHECK(ps, "some", "usual", "path"); + PS_CHECK(ps, "some", "usual", "path"); #else - PS_CHECK(ps, "some\\usual", "path"); + PS_CHECK(ps, "some\\usual", "path"); #endif - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - } - + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + } + Y_UNIT_TEST(WinParsePartMixed) { PSUF(TPathSplit) ps("some\\usual/path"); - ps.ParsePart("sub/sub\\path"); + ps.ParsePart("sub/sub\\path"); #ifdef _win_ - PS_CHECK(ps, "some", "usual", "path", "sub", "sub", "path"); + PS_CHECK(ps, "some", "usual", "path", "sub", "sub", "path"); #else - PS_CHECK(ps, "some\\usual", "path", "sub", "sub\\path"); + PS_CHECK(ps, "some\\usual", "path", "sub", "sub\\path"); #endif - UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); - } - + UNIT_ASSERT_EQUAL(ps.IsAbsolute, false); + } + Y_UNIT_TEST(BeginWithSelf) { PSUF(TPathSplit) ps("./some/usual/path"); - PS_CHECK(ps, "some", "usual", "path"); + PS_CHECK(ps, "some", "usual", "path"); #ifdef _win_ - UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "some\\usual\\path"); + UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "some\\usual\\path"); #else - UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "some/usual/path"); + UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "some/usual/path"); #endif - } - + } + Y_UNIT_TEST(BeginWithParent) { PSUF(TPathSplit) ps("../some/usual/path"); - PS_CHECK(ps, "..", "some", "usual", "path"); + PS_CHECK(ps, "..", "some", "usual", "path"); #ifdef _win_ - UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "..\\some\\usual\\path"); + UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "..\\some\\usual\\path"); #else - UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "../some/usual/path"); + UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "../some/usual/path"); #endif - } - + } + Y_UNIT_TEST(InOut) { PSUF(TPathSplit) ps("path/.."); - PS_CHECK(ps); - UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), ""); - } - + PS_CHECK(ps); + UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), ""); + } + Y_UNIT_TEST(OutIn) { PSUF(TPathSplit) ps("../path"); - PS_CHECK(ps, "..", "path"); + PS_CHECK(ps, "..", "path"); #ifdef _win_ - UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "..\\path"); + UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "..\\path"); #else - UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "../path"); + UNIT_ASSERT_STRINGS_EQUAL(ps.Reconstruct(), "../path"); #endif - } -} - + } +} + Y_UNIT_TEST_SUITE(PSUF(PathSplitTraits)) { Y_UNIT_TEST(IsPathSep) { - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsPathSep('/'), true); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsPathSep('\\'), TRUE_ONLY_WIN); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsPathSep(' '), false); - } - + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsPathSep('/'), true); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsPathSep('\\'), TRUE_ONLY_WIN); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsPathSep(' '), false); + } + Y_UNIT_TEST(IsAbsolutePath) { - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath(""), false); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("/"), true); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("some/usual/path"), false); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("/some/usual/path"), true); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("."), false); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath(".."), false); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("/."), true); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("/.."), true); - } - + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath(""), false); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("/"), true); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("some/usual/path"), false); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("/some/usual/path"), true); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("."), false); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath(".."), false); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("/."), true); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("/.."), true); + } + Y_UNIT_TEST(WinIsAbsolutePath) { - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("somepath"), false); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("\\"), TRUE_ONLY_WIN); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("\\somepath"), TRUE_ONLY_WIN); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("\\."), TRUE_ONLY_WIN); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("\\.."), TRUE_ONLY_WIN); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("C"), false); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("C:"), TRUE_ONLY_WIN); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("C:somepath"), false); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("C:\\"), TRUE_ONLY_WIN); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("C:\\somepath"), TRUE_ONLY_WIN); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("C:/"), TRUE_ONLY_WIN); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("C:/somepath"), TRUE_ONLY_WIN); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("#:"), false); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("#:somepath"), false); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("#:\\somepath"), false); - UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("#:/somepath"), false); - } -} - + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("somepath"), false); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("\\"), TRUE_ONLY_WIN); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("\\somepath"), TRUE_ONLY_WIN); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("\\."), TRUE_ONLY_WIN); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("\\.."), TRUE_ONLY_WIN); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("C"), false); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("C:"), TRUE_ONLY_WIN); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("C:somepath"), false); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("C:\\"), TRUE_ONLY_WIN); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("C:\\somepath"), TRUE_ONLY_WIN); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("C:/"), TRUE_ONLY_WIN); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("C:/somepath"), TRUE_ONLY_WIN); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("#:"), false); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("#:somepath"), false); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("#:\\somepath"), false); + UNIT_ASSERT_EQUAL(PSUF_LOCAL(TPathSplitTraits)::IsAbsolutePath("#:/somepath"), false); + } +} + #undef TRUE_ONLY_WIN - -#endif + +#endif diff --git a/util/generic/benchmark/fastclp2/metrics/ya.make b/util/generic/benchmark/fastclp2/metrics/ya.make index 079d0ce5e3..b2d17ebad3 100644 --- a/util/generic/benchmark/fastclp2/metrics/ya.make +++ b/util/generic/benchmark/fastclp2/metrics/ya.make @@ -14,8 +14,8 @@ TAG( ya:fat ) -TEST_SRCS(main.py) +TEST_SRCS(main.py) -DEPENDS(util/generic/benchmark/fastclp2) +DEPENDS(util/generic/benchmark/fastclp2) END() diff --git a/util/generic/benchmark/log2/metrics/ya.make b/util/generic/benchmark/log2/metrics/ya.make index afef38ed11..eb987e38d2 100644 --- a/util/generic/benchmark/log2/metrics/ya.make +++ b/util/generic/benchmark/log2/metrics/ya.make @@ -14,8 +14,8 @@ TAG( ya:fat ) -TEST_SRCS(main.py) +TEST_SRCS(main.py) -DEPENDS(util/generic/benchmark/log2) +DEPENDS(util/generic/benchmark/log2) END() diff --git a/util/generic/benchmark/rotate_bits/metrics/ya.make b/util/generic/benchmark/rotate_bits/metrics/ya.make index 1e08b6019c..ac27d2f845 100644 --- a/util/generic/benchmark/rotate_bits/metrics/ya.make +++ b/util/generic/benchmark/rotate_bits/metrics/ya.make @@ -14,8 +14,8 @@ TAG( ya:fat ) -TEST_SRCS(main.py) +TEST_SRCS(main.py) -DEPENDS(util/generic/benchmark/rotate_bits) +DEPENDS(util/generic/benchmark/rotate_bits) END() diff --git a/util/generic/benchmark/vector_count_ctor/metrics/ya.make b/util/generic/benchmark/vector_count_ctor/metrics/ya.make index edbf2a463b..c48f89b564 100644 --- a/util/generic/benchmark/vector_count_ctor/metrics/ya.make +++ b/util/generic/benchmark/vector_count_ctor/metrics/ya.make @@ -14,8 +14,8 @@ TAG( ya:fat ) -TEST_SRCS(main.py) +TEST_SRCS(main.py) -DEPENDS(util/generic/benchmark/vector_count_ctor) +DEPENDS(util/generic/benchmark/vector_count_ctor) END() diff --git a/util/generic/bitmap.h b/util/generic/bitmap.h index 4e65dd9036..f77d182460 100644 --- a/util/generic/bitmap.h +++ b/util/generic/bitmap.h @@ -9,7 +9,7 @@ #include <util/system/yassert.h> #include <util/system/defaults.h> -#include <util/str_stl.h> +#include <util/str_stl.h> #include <util/ysaveload.h> namespace NBitMapPrivate { @@ -985,21 +985,21 @@ public: } Mask.Sanitize(); } - - inline size_t Hash() const { - THash<TChunk> chunkHasher; - - size_t hash = chunkHasher(0); - bool tailSkipped = false; - for (size_t i = Mask.GetChunkCapacity(); i > 0; --i) { - if (tailSkipped || Mask.Data[i - 1]) { - hash = ::CombineHashes(hash, chunkHasher(Mask.Data[i - 1])); - tailSkipped = true; - } - } - - return hash; - } + + inline size_t Hash() const { + THash<TChunk> chunkHasher; + + size_t hash = chunkHasher(0); + bool tailSkipped = false; + for (size_t i = Mask.GetChunkCapacity(); i > 0; --i) { + if (tailSkipped || Mask.Data[i - 1]) { + hash = ::CombineHashes(hash, chunkHasher(Mask.Data[i - 1])); + tailSkipped = true; + } + } + + return hash; + } inline const TChunk* GetChunks() const { return Mask.Data; @@ -1105,10 +1105,10 @@ public: using TDynBitMap = TBitMapOps<TDynamicBitMapTraits<ui64>>; #define Y_FOR_EACH_BIT(var, bitmap) for (size_t var = (bitmap).FirstNonZeroBit(); var != (bitmap).Size(); var = (bitmap).NextNonZeroBit(var)) - -template <typename TTraits> + +template <typename TTraits> struct THash<TBitMapOps<TTraits>> { - size_t operator()(const TBitMapOps<TTraits>& elem) const { - return elem.Hash(); - } -}; + size_t operator()(const TBitMapOps<TTraits>& elem) const { + return elem.Hash(); + } +}; diff --git a/util/generic/bitmap_ut.cpp b/util/generic/bitmap_ut.cpp index bf139cda08..087d34a8dc 100644 --- a/util/generic/bitmap_ut.cpp +++ b/util/generic/bitmap_ut.cpp @@ -474,80 +474,80 @@ Y_UNIT_TEST_SUITE(TBitMapTest) { UNIT_ASSERT_EQUAL(bitmap4.NextNonZeroBit(127), bitmap4.Size()); UNIT_ASSERT_EQUAL(bitmap4.NextNonZeroBit(533), bitmap4.Size()); } - + Y_UNIT_TEST(TestHashFixed) { - TBitMap<32, ui8> bitmap32; - TBitMap<32, ui8> bitmap322; - TBitMap<64, ui8> bitmap64; - - bitmap32.Clear(); - bitmap322.Clear(); - UNIT_ASSERT_EQUAL(bitmap32.Hash(), bitmap322.Hash()); - bitmap32.Set(0); - UNIT_ASSERT_UNEQUAL(bitmap32.Hash(), bitmap322.Hash()); - bitmap322.Set(0); - UNIT_ASSERT_EQUAL(bitmap32.Hash(), bitmap322.Hash()); - bitmap32.Set(8).Set(31); - UNIT_ASSERT_UNEQUAL(bitmap32.Hash(), bitmap322.Hash()); - bitmap322.Set(8).Set(31); - UNIT_ASSERT_EQUAL(bitmap32.Hash(), bitmap322.Hash()); - - bitmap32.Clear(); - bitmap64.Clear(); - UNIT_ASSERT_EQUAL(bitmap32.Hash(), bitmap64.Hash()); - bitmap32.Set(0); - UNIT_ASSERT_UNEQUAL(bitmap32.Hash(), bitmap64.Hash()); - bitmap64.Set(0); - UNIT_ASSERT_EQUAL(bitmap32.Hash(), bitmap64.Hash()); - bitmap32.Set(8).Set(31); - UNIT_ASSERT_UNEQUAL(bitmap32.Hash(), bitmap64.Hash()); - bitmap64.Set(8).Set(31); - UNIT_ASSERT_EQUAL(bitmap32.Hash(), bitmap64.Hash()); - bitmap64.Set(32); - UNIT_ASSERT_UNEQUAL(bitmap32.Hash(), bitmap64.Hash()); - } - + TBitMap<32, ui8> bitmap32; + TBitMap<32, ui8> bitmap322; + TBitMap<64, ui8> bitmap64; + + bitmap32.Clear(); + bitmap322.Clear(); + UNIT_ASSERT_EQUAL(bitmap32.Hash(), bitmap322.Hash()); + bitmap32.Set(0); + UNIT_ASSERT_UNEQUAL(bitmap32.Hash(), bitmap322.Hash()); + bitmap322.Set(0); + UNIT_ASSERT_EQUAL(bitmap32.Hash(), bitmap322.Hash()); + bitmap32.Set(8).Set(31); + UNIT_ASSERT_UNEQUAL(bitmap32.Hash(), bitmap322.Hash()); + bitmap322.Set(8).Set(31); + UNIT_ASSERT_EQUAL(bitmap32.Hash(), bitmap322.Hash()); + + bitmap32.Clear(); + bitmap64.Clear(); + UNIT_ASSERT_EQUAL(bitmap32.Hash(), bitmap64.Hash()); + bitmap32.Set(0); + UNIT_ASSERT_UNEQUAL(bitmap32.Hash(), bitmap64.Hash()); + bitmap64.Set(0); + UNIT_ASSERT_EQUAL(bitmap32.Hash(), bitmap64.Hash()); + bitmap32.Set(8).Set(31); + UNIT_ASSERT_UNEQUAL(bitmap32.Hash(), bitmap64.Hash()); + bitmap64.Set(8).Set(31); + UNIT_ASSERT_EQUAL(bitmap32.Hash(), bitmap64.Hash()); + bitmap64.Set(32); + UNIT_ASSERT_UNEQUAL(bitmap32.Hash(), bitmap64.Hash()); + } + Y_UNIT_TEST(TestHashDynamic) { - TDynBitMap bitmap1; - TDynBitMap bitmap2; - - bitmap1.Clear(); - bitmap2.Clear(); - UNIT_ASSERT_EQUAL(bitmap1.Hash(), bitmap2.Hash()); - bitmap1.Set(0); - UNIT_ASSERT_UNEQUAL(bitmap1.Hash(), bitmap2.Hash()); - bitmap2.Set(0); - UNIT_ASSERT_EQUAL(bitmap1.Hash(), bitmap2.Hash()); - bitmap1.Set(8).Set(31); - UNIT_ASSERT_UNEQUAL(bitmap1.Hash(), bitmap2.Hash()); - bitmap2.Set(8).Set(31); - UNIT_ASSERT_EQUAL(bitmap1.Hash(), bitmap2.Hash()); - bitmap1.Set(64); - UNIT_ASSERT_UNEQUAL(bitmap1.Hash(), bitmap2.Hash()); - bitmap2.Set(64); - UNIT_ASSERT_EQUAL(bitmap1.Hash(), bitmap2.Hash()); - } - + TDynBitMap bitmap1; + TDynBitMap bitmap2; + + bitmap1.Clear(); + bitmap2.Clear(); + UNIT_ASSERT_EQUAL(bitmap1.Hash(), bitmap2.Hash()); + bitmap1.Set(0); + UNIT_ASSERT_UNEQUAL(bitmap1.Hash(), bitmap2.Hash()); + bitmap2.Set(0); + UNIT_ASSERT_EQUAL(bitmap1.Hash(), bitmap2.Hash()); + bitmap1.Set(8).Set(31); + UNIT_ASSERT_UNEQUAL(bitmap1.Hash(), bitmap2.Hash()); + bitmap2.Set(8).Set(31); + UNIT_ASSERT_EQUAL(bitmap1.Hash(), bitmap2.Hash()); + bitmap1.Set(64); + UNIT_ASSERT_UNEQUAL(bitmap1.Hash(), bitmap2.Hash()); + bitmap2.Set(64); + UNIT_ASSERT_EQUAL(bitmap1.Hash(), bitmap2.Hash()); + } + Y_UNIT_TEST(TestHashMixed) { static_assert((std::is_same<TDynBitMap::TChunk, ui64>::value), "expect (TSameType<TDynBitMap::TChunk, ui64>::Result)"); - - TBitMap<sizeof(ui64) * 16, ui64> bitmapFixed; - TDynBitMap bitmapDynamic; - - bitmapFixed.Clear(); - bitmapDynamic.Clear(); - UNIT_ASSERT_EQUAL(bitmapFixed.Hash(), bitmapDynamic.Hash()); - bitmapFixed.Set(0); - UNIT_ASSERT_UNEQUAL(bitmapFixed.Hash(), bitmapDynamic.Hash()); - bitmapDynamic.Set(0); - UNIT_ASSERT_EQUAL(bitmapFixed.Hash(), bitmapDynamic.Hash()); - bitmapFixed.Set(8).Set(127); - UNIT_ASSERT_UNEQUAL(bitmapFixed.Hash(), bitmapDynamic.Hash()); - bitmapDynamic.Set(8).Set(127); - UNIT_ASSERT_EQUAL(bitmapFixed.Hash(), bitmapDynamic.Hash()); - bitmapDynamic.Set(128); - UNIT_ASSERT_UNEQUAL(bitmapFixed.Hash(), bitmapDynamic.Hash()); - } + + TBitMap<sizeof(ui64) * 16, ui64> bitmapFixed; + TDynBitMap bitmapDynamic; + + bitmapFixed.Clear(); + bitmapDynamic.Clear(); + UNIT_ASSERT_EQUAL(bitmapFixed.Hash(), bitmapDynamic.Hash()); + bitmapFixed.Set(0); + UNIT_ASSERT_UNEQUAL(bitmapFixed.Hash(), bitmapDynamic.Hash()); + bitmapDynamic.Set(0); + UNIT_ASSERT_EQUAL(bitmapFixed.Hash(), bitmapDynamic.Hash()); + bitmapFixed.Set(8).Set(127); + UNIT_ASSERT_UNEQUAL(bitmapFixed.Hash(), bitmapDynamic.Hash()); + bitmapDynamic.Set(8).Set(127); + UNIT_ASSERT_EQUAL(bitmapFixed.Hash(), bitmapDynamic.Hash()); + bitmapDynamic.Set(128); + UNIT_ASSERT_UNEQUAL(bitmapFixed.Hash(), bitmapDynamic.Hash()); + } Y_UNIT_TEST(TestSetResetRange) { // Single chunk diff --git a/util/generic/fuzz/vector/ya.make b/util/generic/fuzz/vector/ya.make index 6b41dd8a0b..b8614f6411 100644 --- a/util/generic/fuzz/vector/ya.make +++ b/util/generic/fuzz/vector/ya.make @@ -1,9 +1,9 @@ FUZZ() -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SUBSCRIBER(g:util-subscribers) SRCS( diff --git a/util/generic/is_in.h b/util/generic/is_in.h index e452d9f96a..4f175ea5eb 100644 --- a/util/generic/is_in.h +++ b/util/generic/is_in.h @@ -3,7 +3,7 @@ #include "typetraits.h" #include <algorithm> -#include <initializer_list> +#include <initializer_list> template <class I, class T> static inline bool IsIn(I f, I l, const T& v); @@ -46,8 +46,8 @@ static inline bool IsIn(const C& c, const T& e) { using namespace NIsInHelper; return TIsInTraits<C, T, TIsAssocCont<C>::value>::IsIn(c, e); } - + template <class T, class U> static inline bool IsIn(std::initializer_list<T> l, const U& e) { return ::IsIn(l.begin(), l.end(), e); -} +} diff --git a/util/generic/is_in_ut.cpp b/util/generic/is_in_ut.cpp index 247f5df4dd..c668bce807 100644 --- a/util/generic/is_in_ut.cpp +++ b/util/generic/is_in_ut.cpp @@ -75,11 +75,11 @@ Y_UNIT_TEST_SUITE(TIsIn) { const char* abc = "abc"; const char* def = "def"; - UNIT_ASSERT(IsIn({6, 2, 12}, 6)); - UNIT_ASSERT(IsIn({6, 2, 12}, 2)); - UNIT_ASSERT(!IsIn({6, 2, 12}, 7)); - UNIT_ASSERT(IsIn({6}, 6)); - UNIT_ASSERT(!IsIn({6}, 7)); + UNIT_ASSERT(IsIn({6, 2, 12}, 6)); + UNIT_ASSERT(IsIn({6, 2, 12}, 2)); + UNIT_ASSERT(!IsIn({6, 2, 12}, 7)); + UNIT_ASSERT(IsIn({6}, 6)); + UNIT_ASSERT(!IsIn({6}, 7)); UNIT_ASSERT(!IsIn(std::initializer_list<int>(), 6)); UNIT_ASSERT(IsIn({TStringBuf("abc"), TStringBuf("def")}, TStringBuf("abc"))); UNIT_ASSERT(IsIn({TStringBuf("abc"), TStringBuf("def")}, TStringBuf("def"))); @@ -92,8 +92,8 @@ Y_UNIT_TEST_SUITE(TIsIn) { const TStringBuf str = "abc////"; UNIT_ASSERT(IsIn({"abc", "def"}, TStringBuf{str.data(), 3})); - } - + } + Y_UNIT_TEST(ConfOfTest) { UNIT_ASSERT(IsIn({1, 2, 3}, 1)); UNIT_ASSERT(!IsIn({1, 2, 3}, 4)); diff --git a/util/memory/benchmark/pool/metrics/ya.make b/util/memory/benchmark/pool/metrics/ya.make index 708318f2bc..c671bc5c1c 100644 --- a/util/memory/benchmark/pool/metrics/ya.make +++ b/util/memory/benchmark/pool/metrics/ya.make @@ -1,4 +1,4 @@ -OWNER(g:util) +OWNER(g:util) SUBSCRIBER(g:util-subscribers) PY2TEST() @@ -11,8 +11,8 @@ TAG( ya:fat ) -TEST_SRCS(main.py) +TEST_SRCS(main.py) -DEPENDS(util/memory/benchmark/pool) +DEPENDS(util/memory/benchmark/pool) END() diff --git a/util/memory/benchmark/pool/ya.make b/util/memory/benchmark/pool/ya.make index 64ba83eec7..5f4f7d3f15 100644 --- a/util/memory/benchmark/pool/ya.make +++ b/util/memory/benchmark/pool/ya.make @@ -1,4 +1,4 @@ -OWNER(g:util) +OWNER(g:util) SUBSCRIBER(g:util-subscribers) Y_BENCHMARK() diff --git a/util/memory/benchmark/ya.make b/util/memory/benchmark/ya.make index 73b42a5fcf..2259b9434e 100644 --- a/util/memory/benchmark/ya.make +++ b/util/memory/benchmark/ya.make @@ -1,4 +1,4 @@ -OWNER(g:util) +OWNER(g:util) SUBSCRIBER(g:util-subscribers) RECURSE( diff --git a/util/random/benchmark/prng/metrics/ya.make b/util/random/benchmark/prng/metrics/ya.make index d89e6a6b52..1f56aac0bd 100644 --- a/util/random/benchmark/prng/metrics/ya.make +++ b/util/random/benchmark/prng/metrics/ya.make @@ -14,8 +14,8 @@ TAG( ya:fat ) -TEST_SRCS(main.py) +TEST_SRCS(main.py) -DEPENDS(util/random/benchmark/prng) +DEPENDS(util/random/benchmark/prng) END() diff --git a/util/string/benchmark/float_to_string/metrics/ya.make b/util/string/benchmark/float_to_string/metrics/ya.make index 9d9c71dbbc..4b8c4cc07d 100644 --- a/util/string/benchmark/float_to_string/metrics/ya.make +++ b/util/string/benchmark/float_to_string/metrics/ya.make @@ -14,8 +14,8 @@ TAG( ya:fat ) -TEST_SRCS(main.py) +TEST_SRCS(main.py) -DEPENDS(util/string/benchmark/float_to_string) +DEPENDS(util/string/benchmark/float_to_string) END() diff --git a/util/string/benchmark/float_to_string/ya.make b/util/string/benchmark/float_to_string/ya.make index 83bba6a0dd..8136ad34f0 100644 --- a/util/string/benchmark/float_to_string/ya.make +++ b/util/string/benchmark/float_to_string/ya.make @@ -1,9 +1,9 @@ -OWNER(yazevnul) +OWNER(yazevnul) Y_BENCHMARK() -# to minimize allocations overhead -ALLOCATOR(B) +# to minimize allocations overhead +ALLOCATOR(B) SRCS( main.cpp diff --git a/util/string/benchmark/join/metrics/ya.make b/util/string/benchmark/join/metrics/ya.make index 51aaacab3b..08ff3a149f 100644 --- a/util/string/benchmark/join/metrics/ya.make +++ b/util/string/benchmark/join/metrics/ya.make @@ -14,8 +14,8 @@ TAG( ya:fat ) -TEST_SRCS(main.py) +TEST_SRCS(main.py) -DEPENDS(util/string/benchmark/join) +DEPENDS(util/string/benchmark/join) END() diff --git a/util/string/benchmark/subst_global/metrics/ya.make b/util/string/benchmark/subst_global/metrics/ya.make index 7f9d9e5e76..d8c30ad460 100644 --- a/util/string/benchmark/subst_global/metrics/ya.make +++ b/util/string/benchmark/subst_global/metrics/ya.make @@ -14,8 +14,8 @@ TAG( ya:fat ) -TEST_SRCS(main.py) +TEST_SRCS(main.py) -DEPENDS(util/string/benchmark/subst_global) +DEPENDS(util/string/benchmark/subst_global) END() diff --git a/util/string/benchmark/subst_global/ya.make b/util/string/benchmark/subst_global/ya.make index 83bba6a0dd..8136ad34f0 100644 --- a/util/string/benchmark/subst_global/ya.make +++ b/util/string/benchmark/subst_global/ya.make @@ -1,9 +1,9 @@ -OWNER(yazevnul) +OWNER(yazevnul) Y_BENCHMARK() -# to minimize allocations overhead -ALLOCATOR(B) +# to minimize allocations overhead +ALLOCATOR(B) SRCS( main.cpp diff --git a/util/string/fuzzing/collapse/ya.make b/util/string/fuzzing/collapse/ya.make index 6b41dd8a0b..b8614f6411 100644 --- a/util/string/fuzzing/collapse/ya.make +++ b/util/string/fuzzing/collapse/ya.make @@ -1,9 +1,9 @@ FUZZ() -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SUBSCRIBER(g:util-subscribers) SRCS( diff --git a/util/string/fuzzing/strtod/ya.make b/util/string/fuzzing/strtod/ya.make index 6b41dd8a0b..b8614f6411 100644 --- a/util/string/fuzzing/strtod/ya.make +++ b/util/string/fuzzing/strtod/ya.make @@ -1,9 +1,9 @@ FUZZ() -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SUBSCRIBER(g:util-subscribers) SRCS( diff --git a/util/system/benchmark/cpu_id/metrics/ya.make b/util/system/benchmark/cpu_id/metrics/ya.make index 9e36d9c13b..8c55def99b 100644 --- a/util/system/benchmark/cpu_id/metrics/ya.make +++ b/util/system/benchmark/cpu_id/metrics/ya.make @@ -14,8 +14,8 @@ TAG( ya:fat ) -TEST_SRCS(main.py) +TEST_SRCS(main.py) -DEPENDS(util/system/benchmark/cpu_id) +DEPENDS(util/system/benchmark/cpu_id) END() diff --git a/util/system/benchmark/create_destroy_thread/metrics/ya.make b/util/system/benchmark/create_destroy_thread/metrics/ya.make index c5d63db55e..d526487e1a 100644 --- a/util/system/benchmark/create_destroy_thread/metrics/ya.make +++ b/util/system/benchmark/create_destroy_thread/metrics/ya.make @@ -14,8 +14,8 @@ TAG( ya:fat ) -TEST_SRCS(main.py) +TEST_SRCS(main.py) -DEPENDS(util/system/benchmark/create_destroy_thread) +DEPENDS(util/system/benchmark/create_destroy_thread) END() diff --git a/util/system/benchmark/create_destroy_thread/ya.make b/util/system/benchmark/create_destroy_thread/ya.make index 27d120b678..03eb0ec8e0 100644 --- a/util/system/benchmark/create_destroy_thread/ya.make +++ b/util/system/benchmark/create_destroy_thread/ya.make @@ -1,4 +1,4 @@ -OWNER(yazevnul) +OWNER(yazevnul) Y_BENCHMARK() diff --git a/util/system/getpid.cpp b/util/system/getpid.cpp index e93123a0cd..b9615f0dfa 100644 --- a/util/system/getpid.cpp +++ b/util/system/getpid.cpp @@ -14,7 +14,7 @@ #include <unistd.h> #endif -TProcessId GetPID() { +TProcessId GetPID() { #ifdef _win_ return GetCurrentProcessId(); #else diff --git a/util/system/getpid.h b/util/system/getpid.h index 8f86d6712d..60e243266f 100644 --- a/util/system/getpid.h +++ b/util/system/getpid.h @@ -1,12 +1,12 @@ #pragma once -#include "platform.h" -#include "types.h" +#include "platform.h" +#include "types.h" -#if defined(_win_) -using TProcessId = ui32; // DWORD -#else -using TProcessId = pid_t; -#endif - -TProcessId GetPID(); +#if defined(_win_) +using TProcessId = ui32; // DWORD +#else +using TProcessId = pid_t; +#endif + +TProcessId GetPID(); diff --git a/util/system/getpid_ut.cpp b/util/system/getpid_ut.cpp index a3ee6247d1..e7122a2971 100644 --- a/util/system/getpid_ut.cpp +++ b/util/system/getpid_ut.cpp @@ -14,6 +14,6 @@ public: UNIT_TEST_SUITE_REGISTRATION(TGetPidTest); void TGetPidTest::Test() { - const TProcessId pid = GetPID(); + const TProcessId pid = GetPID(); UNIT_ASSERT(pid != 0); } diff --git a/util/system/shellcommand.cpp b/util/system/shellcommand.cpp index 7c29580e21..b1989b5c8c 100644 --- a/util/system/shellcommand.cpp +++ b/util/system/shellcommand.cpp @@ -15,7 +15,7 @@ #include <util/stream/str.h> #include <util/string/cast.h> #include <util/system/info.h> - + #include <errno.h> #if defined(_unix_) @@ -87,8 +87,8 @@ namespace { } } #elif defined(_win_) - constexpr static size_t MAX_COMMAND_LINE = 32 * 1024; - + constexpr static size_t MAX_COMMAND_LINE = 32 * 1024; + std::wstring GetWString(const char* astring) { if (!astring) return std::wstring(); @@ -400,7 +400,7 @@ public: kill(-Pid, SIGTERM); // between a failed kill(-Pid) and a successful kill(Pid) a grandchild could have been spawned } #else - TerminateProcess(Pid, 1 /* exit code */); + TerminateProcess(Pid, 1 /* exit code */); #endif if (!ok) { ythrow TSystemError() << "cannot terminate " << Pid; @@ -562,10 +562,10 @@ void TShellCommand::TImpl::StartProcess(TShellCommand::TImpl::TPipes& pipes) { // winapi can modify command text, copy it Y_ENSURE_EX(cmd.size() < MAX_COMMAND_LINE, yexception() << "Command is too long (length=" << cmd.size() << ")"); - TTempArray<wchar_t> cmdcopy(MAX_COMMAND_LINE); + TTempArray<wchar_t> cmdcopy(MAX_COMMAND_LINE); Copy(cmd.data(), cmd.data() + cmd.size(), cmdcopy.Data()); *(cmdcopy.Data() + cmd.size()) = 0; - + const wchar_t* cwd = NULL; std::wstring cwdBuff; if (WorkDir.size()) { @@ -591,7 +591,7 @@ void TShellCommand::TImpl::StartProcess(TShellCommand::TImpl::TPipes& pipes) { if (User.Name.empty() || GetUsername() == User.Name) { res = CreateProcessW( nullptr, // image name - cmdcopy.Data(), + cmdcopy.Data(), nullptr, // process security attributes nullptr, // thread security attributes TRUE, // inherit handles - needed for IO, CloseAllFdsOnExec not respected @@ -607,7 +607,7 @@ void TShellCommand::TImpl::StartProcess(TShellCommand::TImpl::TPipes& pipes) { GetWString(User.Password.data()).c_str(), 0, // logon flags NULL, // image name - cmdcopy.Data(), + cmdcopy.Data(), 0, // obscure creation flags lpEnvironment, // environment cwd, // current directory @@ -619,11 +619,11 @@ void TShellCommand::TImpl::StartProcess(TShellCommand::TImpl::TPipes& pipes) { AtomicSet(ExecutionStatus, SHELL_ERROR); /// @todo: write to error stream if set TStringOutput out(CollectedError); - out << "Process was not created: " << LastSystemErrorText() << " command text was: '" << GetAString(cmdcopy.Data()) << "'"; + out << "Process was not created: " << LastSystemErrorText() << " command text was: '" << GetAString(cmdcopy.Data()) << "'"; } - Pid = process_info.hProcess; + Pid = process_info.hProcess; CloseHandle(process_info.hThread); - DBG(Cerr << "created process id " << Pid << " in dir: " << cwd << ", cmd: " << cmdcopy.Data() << Endl); + DBG(Cerr << "created process id " << Pid << " in dir: " << cwd << ", cmd: " << cmdcopy.Data() << Endl); } #endif @@ -1073,7 +1073,7 @@ void TShellCommand::TImpl::Communicate(TProcessInfo* pi) { #else if (waitPidResult == WAIT_OBJECT_0) { DWORD exitCode = STILL_ACTIVE; - if (!GetExitCodeProcess(pi->Parent->Pid, &exitCode)) { + if (!GetExitCodeProcess(pi->Parent->Pid, &exitCode)) { ythrow yexception() << "GetExitCodeProcess: " << LastSystemErrorText(); } if (exitCode == 0) diff --git a/util/system/shellcommand_ut.cpp b/util/system/shellcommand_ut.cpp index 9791617740..9d849279d2 100644 --- a/util/system/shellcommand_ut.cpp +++ b/util/system/shellcommand_ut.cpp @@ -1,5 +1,5 @@ #include "shellcommand.h" - + #include "compat.h" #include "defaults.h" #include "fs.h" @@ -266,7 +266,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) { void DoWrite(const void* buf, size_t len) override { Y_UNUSED(buf); Y_UNUSED(len); - } + } void DoFinish() override { ++NumCloses; } @@ -278,7 +278,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) { auto options = TShellCommandOptions().SetCloseStreams(true).SetOutputStream(&stream).SetErrorStream(&stream); TShellCommand("echo hello", options).Run().Wait(); - UNIT_ASSERT_VALUES_EQUAL(stream.NumCloses, 2); + UNIT_ASSERT_VALUES_EQUAL(stream.NumCloses, 2); } Y_UNIT_TEST(TestInterruptSimple) { TShellCommandOptions options; diff --git a/util/system/ut/ya.make b/util/system/ut/ya.make index 8dc3f6b7e1..127e7c261e 100644 --- a/util/system/ut/ya.make +++ b/util/system/ut/ya.make @@ -4,11 +4,11 @@ OWNER(g:util) SUBSCRIBER(g:util-subscribers) FORK_TESTS() - + FORK_SUBTESTS() - + SPLIT_FACTOR(40) - + TIMEOUT(300) SIZE(MEDIUM) diff --git a/util/tests/cython/ya.make b/util/tests/cython/ya.make index 58496b5e21..b928c19026 100644 --- a/util/tests/cython/ya.make +++ b/util/tests/cython/ya.make @@ -8,8 +8,8 @@ SRCDIR(util) NO_WSHADOW() PY_SRCS( - NAMESPACE - util + NAMESPACE + util folder/path_ut.pyx generic/array_ref_ut.pyx generic/deque_ut.pyx diff --git a/util/tests/sym_versions/ya.make b/util/tests/sym_versions/ya.make index dbad2f60fd..3957c60fc9 100644 --- a/util/tests/sym_versions/ya.make +++ b/util/tests/sym_versions/ya.make @@ -1,13 +1,13 @@ PY2TEST() -OWNER( - pg - g:util +OWNER( + pg + g:util ) SUBSCRIBER(g:util-subscribers) -TEST_SRCS(test_glibc.py) - +TEST_SRCS(test_glibc.py) + PEERDIR( library/python/resource ) @@ -17,26 +17,26 @@ RESOURCE( ) DEPENDS( - # start binaries - util/generic/ut - util/charset/ut - util/datetime/ut - util/digest/ut - util/draft/ut - util/folder/ut - util/memory/ut - util/network/ut - util/random/ut - util/stream/ut - util/string/ut - util/system/ut - util/thread/ut - # end binaries - contrib/python/pyelftools/readelf + # start binaries + util/generic/ut + util/charset/ut + util/datetime/ut + util/digest/ut + util/draft/ut + util/folder/ut + util/memory/ut + util/network/ut + util/random/ut + util/stream/ut + util/string/ut + util/system/ut + util/thread/ut + # end binaries + contrib/python/pyelftools/readelf ) FORK_SUBTESTS() - + SPLIT_FACTOR(10) END() diff --git a/util/tests/ya.make b/util/tests/ya.make index c5bb4aeb7e..e1e85c2931 100644 --- a/util/tests/ya.make +++ b/util/tests/ya.make @@ -7,7 +7,7 @@ RECURSE( ) IF (OS_LINUX) - RECURSE( - sym_versions - ) + RECURSE( + sym_versions + ) ENDIF() diff --git a/util/ya.make b/util/ya.make index edb7ce4faf..6ebe7e40cf 100644 --- a/util/ya.make +++ b/util/ya.make @@ -3,16 +3,16 @@ LIBRARY(yutil) OWNER(g:util) SUBSCRIBER(g:util-subscribers) -NEED_CHECK() - +NEED_CHECK() + NO_UTIL() -# stream -# string +# stream +# string PEERDIR( util/charset - contrib/libs/zlib - contrib/libs/double-conversion + contrib/libs/zlib + contrib/libs/double-conversion ) PEERDIR( @@ -31,8 +31,8 @@ JOIN_SRCS( SRCS( datetime/parser.rl6 - digest/city.cpp - random/random.cpp + digest/city.cpp + random/random.cpp string/cast.cpp ) |