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 | 8cac63f90980b825f78cbd01f45b396297047c2c (patch) | |
tree | b83306b6e37edeea782e9eed673d89286c4fef35 | |
parent | 3f4e5b0a63eff1c9296c05552fabdd5e3d9371f7 (diff) | |
download | ydb-8cac63f90980b825f78cbd01f45b396297047c2c.tar.gz |
Restoring authorship annotation for <my34@yandex-team.ru>. Commit 2 of 2.
-rw-r--r-- | contrib/libs/ya.make | 2 | ||||
-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 | 0 -> 25 bytes | |||
-rw-r--r-- | library/cpp/containers/comptrie/loader/ut/ya.make | 30 | ||||
-rw-r--r-- | library/cpp/containers/comptrie/loader/ya.make | 24 |
6 files changed, 56 insertions, 56 deletions
diff --git a/contrib/libs/ya.make b/contrib/libs/ya.make index 4eff9a2edf..9c4640fdcf 100644 --- a/contrib/libs/ya.make +++ b/contrib/libs/ya.make @@ -106,7 +106,7 @@ RECURSE( httpd24 hwloc hyperscan - i18n + i18n i18n/ut icu ImageMagick diff --git a/library/cpp/containers/comptrie/loader/loader.h b/library/cpp/containers/comptrie/loader/loader.h index ef3ba69115..ee10e9b451 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 b95f022416..345063a31e 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 differnew file mode 100644 index 0000000000..4af18add2f --- /dev/null +++ b/library/cpp/containers/comptrie/loader/ut/dummy.trie diff --git a/library/cpp/containers/comptrie/loader/ut/ya.make b/library/cpp/containers/comptrie/loader/ut/ya.make index 6f433c9320..6c0334d3ea 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 8904c9ddfb..1e23e442a0 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() |