diff options
author | my34 <my34@yandex-team.ru> | 2022-02-10 16:47:05 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:05 +0300 |
commit | 3f4e5b0a63eff1c9296c05552fabdd5e3d9371f7 (patch) | |
tree | 582a730fd7c91aa8e3f49b8eaa3ae6e212402a0b /library/cpp/containers | |
parent | c74559fb88da8adac0d9186cfa55a6b13c47695f (diff) | |
download | ydb-3f4e5b0a63eff1c9296c05552fabdd5e3d9371f7.tar.gz |
Restoring authorship annotation for <my34@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/containers')
-rw-r--r-- | library/cpp/containers/comptrie/loader/loader.h | 34 | ||||
-rw-r--r-- | library/cpp/containers/comptrie/loader/loader_ut.cpp | 22 | ||||
-rw-r--r-- | library/cpp/containers/comptrie/loader/ut/dummy.trie | bin | 25 -> 0 bytes | |||
-rw-r--r-- | library/cpp/containers/comptrie/loader/ut/ya.make | 30 | ||||
-rw-r--r-- | library/cpp/containers/comptrie/loader/ya.make | 24 |
5 files changed, 55 insertions, 55 deletions
diff --git a/library/cpp/containers/comptrie/loader/loader.h b/library/cpp/containers/comptrie/loader/loader.h index ee10e9b451..ef3ba69115 100644 --- a/library/cpp/containers/comptrie/loader/loader.h +++ b/library/cpp/containers/comptrie/loader/loader.h @@ -1,22 +1,22 @@ -#pragma once - +#pragma once + #include <library/cpp/archive/yarchive.h> #include <util/generic/string.h> -#include <util/generic/ptr.h> -#include <util/generic/yexception.h> -#include <util/memory/blob.h> - -template <class TrieType, size_t N> +#include <util/generic/ptr.h> +#include <util/generic/yexception.h> +#include <util/memory/blob.h> + +template <class TrieType, size_t N> TrieType LoadTrieFromArchive(const TString& key, - const unsigned char (&data)[N], + const unsigned char (&data)[N], bool ignoreErrors = false) { - TArchiveReader archive(TBlob::NoCopy(data, sizeof(data))); - if (archive.Has(key)) { + TArchiveReader archive(TBlob::NoCopy(data, sizeof(data))); + if (archive.Has(key)) { TAutoPtr<IInputStream> trie = archive.ObjectByKey(key); - return TrieType(TBlob::FromStream(*trie)); - } - if (!ignoreErrors) { - ythrow yexception() << "Resource " << key << " not found"; - } - return TrieType(); -} + return TrieType(TBlob::FromStream(*trie)); + } + if (!ignoreErrors) { + ythrow yexception() << "Resource " << key << " not found"; + } + return TrieType(); +} diff --git a/library/cpp/containers/comptrie/loader/loader_ut.cpp b/library/cpp/containers/comptrie/loader/loader_ut.cpp index 345063a31e..b95f022416 100644 --- a/library/cpp/containers/comptrie/loader/loader_ut.cpp +++ b/library/cpp/containers/comptrie/loader/loader_ut.cpp @@ -1,20 +1,20 @@ #include <library/cpp/testing/unittest/registar.h> #include <library/cpp/containers/comptrie/comptrie.h> #include <library/cpp/containers/comptrie/loader/loader.h> - -using TDummyTrie = TCompactTrie<char, i32>; - -namespace { - const unsigned char DATA[] = { + +using TDummyTrie = TCompactTrie<char, i32>; + +namespace { + const unsigned char DATA[] = { #include "data.inc" - }; + }; } - + Y_UNIT_TEST_SUITE(ArchiveLoaderTests) { Y_UNIT_TEST(BaseTest) { TDummyTrie trie = LoadTrieFromArchive<TDummyTrie>("/dummy.trie", DATA, true); UNIT_ASSERT_EQUAL(trie.Size(), 3); - + const TString TrieKyes[3] = { "zero", "one", "two"}; i32 val = -1; @@ -22,9 +22,9 @@ Y_UNIT_TEST_SUITE(ArchiveLoaderTests) { UNIT_ASSERT(trie.Find(TrieKyes[i].data(), TrieKyes[i].size(), &val)); UNIT_ASSERT_EQUAL(i, val); } - + UNIT_CHECK_GENERATED_EXCEPTION( LoadTrieFromArchive<TDummyTrie>("/noname.trie", DATA), yexception); - } -} + } +} diff --git a/library/cpp/containers/comptrie/loader/ut/dummy.trie b/library/cpp/containers/comptrie/loader/ut/dummy.trie Binary files differdeleted file mode 100644 index 4af18add2f..0000000000 --- a/library/cpp/containers/comptrie/loader/ut/dummy.trie +++ /dev/null diff --git a/library/cpp/containers/comptrie/loader/ut/ya.make b/library/cpp/containers/comptrie/loader/ut/ya.make index 6c0334d3ea..6f433c9320 100644 --- a/library/cpp/containers/comptrie/loader/ut/ya.make +++ b/library/cpp/containers/comptrie/loader/ut/ya.make @@ -1,18 +1,18 @@ UNITTEST_FOR(library/cpp/containers/comptrie/loader) - + OWNER(my34) - -ARCHIVE( - NAME data.inc - dummy.trie -) - -SRCS( - loader_ut.cpp -) - -PEERDIR( + +ARCHIVE( + NAME data.inc + dummy.trie +) + +SRCS( + loader_ut.cpp +) + +PEERDIR( library/cpp/containers/comptrie/loader -) - -END() +) + +END() diff --git a/library/cpp/containers/comptrie/loader/ya.make b/library/cpp/containers/comptrie/loader/ya.make index 1e23e442a0..8904c9ddfb 100644 --- a/library/cpp/containers/comptrie/loader/ya.make +++ b/library/cpp/containers/comptrie/loader/ya.make @@ -1,15 +1,15 @@ -LIBRARY() - -OWNER(my34) - -SRCS( - loader.h +LIBRARY() + +OWNER(my34) + +SRCS( + loader.h loader.cpp -) - -PEERDIR( +) + +PEERDIR( library/cpp/archive library/cpp/containers/comptrie -) - -END() +) + +END() |