aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/binsaver/ut
diff options
context:
space:
mode:
authordiver <diver@yandex-team.ru>2022-02-10 16:48:07 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:07 +0300
commite20e2b362f0232ed5a389db887e6e27e7763af18 (patch)
treeb222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp/binsaver/ut
parent7629e1f9ef7f9d2a3c345c97e6a4e5a4b32ee786 (diff)
downloadydb-e20e2b362f0232ed5a389db887e6e27e7763af18.tar.gz
Restoring authorship annotation for <diver@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/binsaver/ut')
-rw-r--r--library/cpp/binsaver/ut/binsaver_ut.cpp84
-rw-r--r--library/cpp/binsaver/ut/ya.make16
2 files changed, 50 insertions, 50 deletions
diff --git a/library/cpp/binsaver/ut/binsaver_ut.cpp b/library/cpp/binsaver/ut/binsaver_ut.cpp
index 218937d244..37eba5406f 100644
--- a/library/cpp/binsaver/ut/binsaver_ut.cpp
+++ b/library/cpp/binsaver/ut/binsaver_ut.cpp
@@ -3,42 +3,42 @@
#include <library/cpp/binsaver/bin_saver.h>
#include <library/cpp/binsaver/ut_util/ut_util.h>
#include <library/cpp/testing/unittest/registar.h>
-
-#include <util/stream/buffer.h>
+
+#include <util/stream/buffer.h>
#include <util/generic/map.h>
-
-struct TBinarySerializable {
- ui32 Data = 0;
-};
-
-struct TNonBinarySerializable {
- ui32 Data = 0;
+
+struct TBinarySerializable {
+ ui32 Data = 0;
+};
+
+struct TNonBinarySerializable {
+ ui32 Data = 0;
TString StrData;
-};
-
-struct TCustomSerializer {
- ui32 Data = 0;
+};
+
+struct TCustomSerializer {
+ ui32 Data = 0;
TString StrData;
- SAVELOAD(StrData, Data);
-};
-
-struct TCustomOuterSerializer {
- ui32 Data = 0;
+ SAVELOAD(StrData, Data);
+};
+
+struct TCustomOuterSerializer {
+ ui32 Data = 0;
TString StrData;
-};
-
+};
+
void operator&(TCustomOuterSerializer& s, IBinSaver& f);
-
-struct TCustomOuterSerializerTmpl {
- ui32 Data = 0;
+
+struct TCustomOuterSerializerTmpl {
+ ui32 Data = 0;
TString StrData;
-};
-
+};
+
struct TCustomOuterSerializerTmplDerived: public TCustomOuterSerializerTmpl {
- ui32 Data = 0;
+ ui32 Data = 0;
TString StrData;
-};
-
+};
+
struct TMoveOnlyType {
ui32 Data = 0;
@@ -62,11 +62,11 @@ struct TTypeWithArray {
template <typename T, typename = std::enable_if_t<std::is_base_of<TCustomOuterSerializerTmpl, T>::value>>
int operator&(T& s, IBinSaver& f);
-
+
static bool operator==(const TBlob& l, const TBlob& r) {
return TStringBuf(l.AsCharPtr(), l.Size()) == TStringBuf(r.AsCharPtr(), r.Size());
}
-
+
Y_UNIT_TEST_SUITE(BinSaver){
Y_UNIT_TEST(HasTrivialSerializer){
UNIT_ASSERT(!IBinSaver::HasNonTrivialSerializer<TBinarySerializable>(0u));
@@ -77,12 +77,12 @@ UNIT_ASSERT(IBinSaver::HasNonTrivialSerializer<TCustomOuterSerializerTmpl>(0u));
UNIT_ASSERT(IBinSaver::HasNonTrivialSerializer<TCustomOuterSerializerTmplDerived>(0u));
UNIT_ASSERT(IBinSaver::HasNonTrivialSerializer<TVector<TCustomSerializer>>(0u));
}
-
-
+
+
Y_UNIT_TEST(TestStroka) {
TestBinSaverSerialization(TString("QWERTY"));
}
-
+
Y_UNIT_TEST(TestMoveOnlyType) {
TestBinSaverSerializationToBuffer(TMoveOnlyType());
}
@@ -104,11 +104,11 @@ Y_UNIT_TEST(TestMaps) {
TestBinSaverSerialization(THashMap<TString, ui32>{{"A", 1}, {"B", 2}, {"C", 3}});
TestBinSaverSerialization(TMap<TString, ui32>{{"A", 1}, {"B", 2}, {"C", 3}});
}
-
+
Y_UNIT_TEST(TestBlob) {
TestBinSaverSerialization(TBlob::FromStringSingleThreaded("qwerty"));
}
-
+
Y_UNIT_TEST(TestVariant) {
{
using T = std::variant<TString, int>;
@@ -140,15 +140,15 @@ Y_UNIT_TEST(TestPod) {
TestBinSaverSerialization(custom);
TestBinSaverSerialization(TVector<TPod>{custom});
}
-
+
Y_UNIT_TEST(TestSubPod) {
struct TPod {
struct TSub {
ui32 X = 10;
bool operator==(const TSub& other) const {
return X == other.X;
- }
- };
+ }
+ };
TVector<TSub> B;
int operator&(IBinSaver& f) {
f.Add(0, &B);
@@ -165,7 +165,7 @@ Y_UNIT_TEST(TestSubPod) {
custom.B = {sub};
TestBinSaverSerialization(TVector<TPod>{custom});
}
-
+
Y_UNIT_TEST(TestMemberAndOpIsMain) {
struct TBase {
TString S;
@@ -175,7 +175,7 @@ Y_UNIT_TEST(TestMemberAndOpIsMain) {
}
virtual ~TBase() = default;
};
-
+
struct TDerived: public TBase {
int A = 0;
int operator&(IBinSaver& f)override {
@@ -187,11 +187,11 @@ Y_UNIT_TEST(TestMemberAndOpIsMain) {
return A == other.A && S == other.S;
}
};
-
+
TDerived obj;
obj.S = "TString";
obj.A = 42;
-
+
TestBinSaverSerialization(obj);
}
}
diff --git a/library/cpp/binsaver/ut/ya.make b/library/cpp/binsaver/ut/ya.make
index d0b48e78aa..43dc20bff7 100644
--- a/library/cpp/binsaver/ut/ya.make
+++ b/library/cpp/binsaver/ut/ya.make
@@ -1,11 +1,11 @@
UNITTEST_FOR(library/cpp/binsaver)
-
-OWNER(gulin)
-
-SRCS(
- binsaver_ut.cpp
-)
-
+
+OWNER(gulin)
+
+SRCS(
+ binsaver_ut.cpp
+)
+
PEERDIR(library/cpp/binsaver/ut_util)
-END()
+END()