aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/packers/ut
diff options
context:
space:
mode:
authorsereglond <sereglond@yandex-team.ru>2022-02-10 16:47:46 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:46 +0300
commiteb3d925534734c808602b31b38b953677f0a279f (patch)
tree4222ef8dc375ee9f30b68a004ee42a0845e005b6 /library/cpp/packers/ut
parent4c8065245df3ea26b7757bcb1f8218df287f9148 (diff)
downloadydb-eb3d925534734c808602b31b38b953677f0a279f.tar.gz
Restoring authorship annotation for <sereglond@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/packers/ut')
-rw-r--r--library/cpp/packers/ut/packers_ut.cpp84
1 files changed, 42 insertions, 42 deletions
diff --git a/library/cpp/packers/ut/packers_ut.cpp b/library/cpp/packers/ut/packers_ut.cpp
index 18ce2150d1..3ddbb641a7 100644
--- a/library/cpp/packers/ut/packers_ut.cpp
+++ b/library/cpp/packers/ut/packers_ut.cpp
@@ -7,9 +7,9 @@
#include <util/generic/algorithm.h>
#include <util/generic/buffer.h>
#include <util/generic/map.h>
-#include <util/generic/vector.h>
-#include <util/generic/ptr.h>
-#include <util/generic/ylimits.h>
+#include <util/generic/vector.h>
+#include <util/generic/ptr.h>
+#include <util/generic/ylimits.h>
#include <util/folder/dirut.h>
@@ -28,69 +28,69 @@ private:
UNIT_TEST(TestPackers);
UNIT_TEST_SUITE_END();
- template <class TData, class TPacker>
- void TestPacker(const TData& data);
-
- template <class TData, class TPacker>
- void TestPacker(const TData* test, size_t size);
-
+ template <class TData, class TPacker>
+ void TestPacker(const TData& data);
+
+ template <class TData, class TPacker>
+ void TestPacker(const TData* test, size_t size);
+
public:
- void TestPackers();
+ void TestPackers();
};
UNIT_TEST_SUITE_REGISTRATION(TPackersTest);
-template <class TData, class TPacker>
+template <class TData, class TPacker>
void TPackersTest::TestPacker(const TData& data) {
- size_t len = TPacker().MeasureLeaf(data);
- size_t bufLen = len * 3;
-
- TArrayHolder<char> buf(new char[bufLen]);
- memset(buf.Get(), -1, bufLen);
-
- TPacker().PackLeaf(buf.Get(), data, len);
-
- UNIT_ASSERT(TPacker().SkipLeaf(buf.Get()) == len);
+ size_t len = TPacker().MeasureLeaf(data);
+ size_t bufLen = len * 3;
+
+ TArrayHolder<char> buf(new char[bufLen]);
+ memset(buf.Get(), -1, bufLen);
+
+ TPacker().PackLeaf(buf.Get(), data, len);
+
+ UNIT_ASSERT(TPacker().SkipLeaf(buf.Get()) == len);
TData dataTmp;
TPacker().UnpackLeaf(buf.Get(), dataTmp);
UNIT_ASSERT(data == dataTmp);
-}
-
-template <class TData, class TPacker>
+}
+
+template <class TData, class TPacker>
void TPackersTest::TestPacker(const TData* test, size_t size) {
- for (size_t i = 0; i < size; ++i) {
- TestPacker<TData, TPacker>(test[i]);
- }
-}
-
+ for (size_t i = 0; i < size; ++i) {
+ TestPacker<TData, TPacker>(test[i]);
+ }
+}
+
void TPackersTest::TestPackers() {
- {
+ {
const TString test[] = {"",
"a", "b", "c", "d",
"aa", "ab", "ac", "ad",
"aaa", "aab", "aac", "aad",
"aba", "abb", "abc", "abd",
"asdfjjmk.gjilsjgilsjilgjildsajgfilsjdfilgjm ldsa8oq43u 583uq4905 -q435 jiores u893q 5oiju fd-KE 89536 9Q2URE 12AI894T3 89 Q*(re43"};
-
+
TestPacker<TString, NPackers::TPacker<TString>>(test, Y_ARRAY_SIZE(test));
-
+
for (size_t i = 0; i != Y_ARRAY_SIZE(test); ++i) {
TestPacker<TUtf16String, NPackers::TPacker<TUtf16String>>(UTF8ToWide(test[i]));
- }
- }
- {
- const ui64 test[] = {
+ }
+ }
+ {
+ const ui64 test[] = {
0, 1, 2, 3, 4, 5, 6, 76, 100000, Max<ui64>()};
-
+
TestPacker<ui64, NPackers::TPacker<ui64>>(test, Y_ARRAY_SIZE(test));
- }
- {
- const int test[] = {
+ }
+ {
+ const int test[] = {
0, 1, 2, 3, 4, 5, 6, 76, 100000, -1, -2, -3, -4, -5, -6, -76, -10000, Min<int>(), Max<int>()};
-
+
TestPacker<int, NPackers::TPacker<int>>(test, Y_ARRAY_SIZE(test));
- }
+ }
{
const float test[] = {
2.f, 3.f, 4.f, 0.f, -0.f, 1.f, -1.f, 1.1f, -1.1f,
@@ -107,4 +107,4 @@ void TPackersTest::TestPackers() {
TestPacker<double, NPackers::TDoublePacker>(test, Y_ARRAY_SIZE(test));
}
-}
+}