aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/codecs/ut/tls_cache_ut.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/codecs/ut/tls_cache_ut.cpp
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/codecs/ut/tls_cache_ut.cpp')
-rw-r--r--library/cpp/codecs/ut/tls_cache_ut.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/library/cpp/codecs/ut/tls_cache_ut.cpp b/library/cpp/codecs/ut/tls_cache_ut.cpp
index 8101af761f..361d41a02e 100644
--- a/library/cpp/codecs/ut/tls_cache_ut.cpp
+++ b/library/cpp/codecs/ut/tls_cache_ut.cpp
@@ -2,35 +2,35 @@
#include <library/cpp/codecs/tls_cache.h>
Y_UNIT_TEST_SUITE(CodecsBufferFactoryTest){
- void AssignToBuffer(TBuffer & buf, TStringBuf val){
+ void AssignToBuffer(TBuffer & buf, TStringBuf val){
buf.Assign(val.data(), val.size());
-}
+}
-TStringBuf AsStringBuf(const TBuffer& b) {
- return TStringBuf(b.Data(), b.Size());
-}
+TStringBuf AsStringBuf(const TBuffer& b) {
+ return TStringBuf(b.Data(), b.Size());
+}
Y_UNIT_TEST(TestAcquireReleaseReuse) {
- NCodecs::TBufferTlsCache factory;
- // acquiring the first buffer
- auto buf1 = factory.Item();
- AssignToBuffer(buf1.Get(), "Buffer_01");
- {
- // acquiring the second buffer
- auto buf2 = factory.Item();
- AssignToBuffer(buf2.Get(), "Buffer_02");
+ NCodecs::TBufferTlsCache factory;
+ // acquiring the first buffer
+ auto buf1 = factory.Item();
+ AssignToBuffer(buf1.Get(), "Buffer_01");
+ {
+ // acquiring the second buffer
+ auto buf2 = factory.Item();
+ AssignToBuffer(buf2.Get(), "Buffer_02");
}
- // the first buffer should stay intact
- UNIT_ASSERT_EQUAL(AsStringBuf(buf1.Get()), "Buffer_01");
- {
- // reacquiring the last released buffer
- // expecting it zero sized but having the same memory
- auto buf2 = factory.Item();
- UNIT_ASSERT_VALUES_EQUAL(buf2.Get().Size(), 0u);
- buf2.Get().Resize(TStringBuf("Buffer_02").Size());
- UNIT_ASSERT_EQUAL(AsStringBuf(buf2.Get()), "Buffer_02");
- }
- // when the factory dies we should see no leaks
-}
-}
-;
+ // the first buffer should stay intact
+ UNIT_ASSERT_EQUAL(AsStringBuf(buf1.Get()), "Buffer_01");
+ {
+ // reacquiring the last released buffer
+ // expecting it zero sized but having the same memory
+ auto buf2 = factory.Item();
+ UNIT_ASSERT_VALUES_EQUAL(buf2.Get().Size(), 0u);
+ buf2.Get().Resize(TStringBuf("Buffer_02").Size());
+ UNIT_ASSERT_EQUAL(AsStringBuf(buf2.Get()), "Buffer_02");
+ }
+ // when the factory dies we should see no leaks
+}
+}
+;