Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Not for merging] Fixes for library unit tests with gtest #292

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions library/cpp/iterator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
if (YDB_SDK_TESTS)
add_subdirectory(ut)
endif()

_ydb_sdk_add_library(iterator)

target_link_libraries(iterator PUBLIC
Expand Down
64 changes: 64 additions & 0 deletions library/cpp/iterator/ut/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
add_ydb_test(NAME iterator-filtering_ut GTEST
SOURCES
filtering_ut.cpp
LINK_LIBRARIES
iterator
GTest::gtest_main
GTest::gmock
LABELS
unit
)

add_ydb_test(NAME iterator-functools_ut GTEST
SOURCES
functools_ut.cpp
LINK_LIBRARIES
iterator
GTest::gtest_main
GTest::gmock
LABELS
unit
)

add_ydb_test(NAME iterator-iterate_keys_ut GTEST
SOURCES
iterate_keys_ut.cpp
LINK_LIBRARIES
iterator
GTest::gtest_main
GTest::gmock
LABELS
unit
)

add_ydb_test(NAME iterator-iterate_values_ut GTEST
SOURCES
iterate_values_ut.cpp
LINK_LIBRARIES
iterator
GTest::gtest_main
GTest::gmock
LABELS
unit
)

add_ydb_test(NAME iterator-mapped_ut GTEST
SOURCES
mapped_ut.cpp
LINK_LIBRARIES
iterator
GTest::gtest_main
GTest::gmock
LABELS
unit
)

add_ydb_test(NAME iterator-zip_ut GTEST
SOURCES
zip_ut.cpp
LINK_LIBRARIES
iterator
GTest::gtest_main
LABELS
unit
)
3 changes: 2 additions & 1 deletion library/cpp/iterator/ut/filtering_ut.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <library/cpp/iterator/filtering.h>

#include <library/cpp/testing/gtest/gtest.h>
#include <gtest/gtest.h>
#include <gmock/gmock.h>

#include <util/generic/vector.h>

Expand Down
3 changes: 2 additions & 1 deletion library/cpp/iterator/ut/functools_ut.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <library/cpp/iterator/functools.h>

#include <library/cpp/testing/gtest/gtest.h>
#include <gtest/gtest.h>
#include <gmock/gmock.h>

#include <util/generic/vector.h>
#include <util/generic/xrange.h>
Expand Down
3 changes: 2 additions & 1 deletion library/cpp/iterator/ut/iterate_keys_ut.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <library/cpp/iterator/iterate_keys.h>

#include <library/cpp/testing/gtest/gtest.h>
#include <gtest/gtest.h>
#include <gmock/gmock.h>

#include <map>

Expand Down
3 changes: 2 additions & 1 deletion library/cpp/iterator/ut/iterate_values_ut.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <library/cpp/iterator/iterate_values.h>

#include <library/cpp/testing/gtest/gtest.h>
#include <gtest/gtest.h>
#include <gmock/gmock.h>

#include <util/generic/algorithm.h>

Expand Down
3 changes: 2 additions & 1 deletion library/cpp/iterator/ut/mapped_ut.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <library/cpp/iterator/mapped.h>

#include <library/cpp/testing/gtest/gtest.h>
#include <gtest/gtest.h>
#include <gmock/gmock.h>

#include <util/generic/map.h>
#include <util/generic/vector.h>
Expand Down
3 changes: 1 addition & 2 deletions library/cpp/iterator/ut/zip_ut.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <library/cpp/iterator/zip.h>

#include <library/cpp/testing/gtest/gtest.h>
#include <gtest/gtest.h>

#include <util/generic/vector.h>

Expand All @@ -25,4 +25,3 @@ TEST(TIterator, ZipSimplePostIncrement) {

EXPECT_EQ(std::next(cur), last);
}

8 changes: 6 additions & 2 deletions library/cpp/yson/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
if (YDB_SDK_TESTS)
add_subdirectory(ut)
endif()

_ydb_sdk_add_library(yson)

target_link_libraries(yson
target_link_libraries(yson
PUBLIC
yutil
yt-misc
yt-yson
)

target_sources(yson
target_sources(yson
PRIVATE
consumer.cpp
lexer.cpp
Expand Down
9 changes: 9 additions & 0 deletions library/cpp/yson/ut/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
add_ydb_test(NAME yson-ut GTEST
SOURCES
yson_ut.cpp
LINK_LIBRARIES
yson
GTest::gtest_main
LABELS
unit
)
2 changes: 1 addition & 1 deletion library/cpp/yson/ut/yson_ut.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <library/cpp/yson/parser.h>
#include <library/cpp/yson/writer.h>

#include <library/cpp/testing/gtest/gtest.h>
#include <gtest/gtest.h>

#include <util/stream/mem.h>

Expand Down
22 changes: 18 additions & 4 deletions library/cpp/yt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
if (YDB_SDK_TESTS)
add_subdirectory(coding/unittests)
add_subdirectory(containers/unittests)
add_subdirectory(memory/unittests)
add_subdirectory(misc/unittests)
add_subdirectory(small_containers/unittests)
add_subdirectory(string/unittests)
add_subdirectory(yson_string/unittests)
endif()

_ydb_sdk_add_library(yt-assert)
target_compile_options(yt-assert PRIVATE
-Wdeprecated-this-capture
Expand Down Expand Up @@ -33,8 +43,11 @@ _ydb_sdk_add_library(yt-exception)
target_compile_options(yt-exception PRIVATE
-Wdeprecated-this-capture
)
target_link_libraries(yt-exception PUBLIC
yutil
target_link_libraries(yt-exception
PUBLIC
yutil
PRIVATE
yt-assert
)
target_sources(yt-exception PRIVATE
exception/exception.cpp
Expand Down Expand Up @@ -107,7 +120,7 @@ _ydb_sdk_install_targets(TARGETS yt-misc)


_ydb_sdk_add_library(yt-small_containers INTERFACE)
target_link_libraries(yt-small_containers
target_link_libraries(yt-small_containers
INTERFACE
yutil
yt-assert
Expand All @@ -121,7 +134,7 @@ _ydb_sdk_add_library(yt-string)
target_compile_options(yt-string PRIVATE
-Wdeprecated-this-capture
)
target_link_libraries(yt-string
target_link_libraries(yt-string
PUBLIC
yutil
yt-assert
Expand All @@ -136,6 +149,7 @@ target_sources(yt-string
string/guid.cpp
string/string.cpp
string/format.cpp
string/format_string.cpp
)
_ydb_sdk_install_targets(TARGETS yt-string)

Expand Down
19 changes: 19 additions & 0 deletions library/cpp/yt/coding/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
add_ydb_test(NAME yt-coding-varint_ut GTEST
SOURCES
varint_ut.cpp
LINK_LIBRARIES
yt-coding
GTest::gtest_main
LABELS
unit
)

add_ydb_test(NAME yt-coding-zig_zag_ut GTEST
SOURCES
zig_zag_ut.cpp
LINK_LIBRARIES
yt-coding
GTest::gtest_main
LABELS
unit
)
4 changes: 3 additions & 1 deletion library/cpp/yt/coding/unittests/varint_ut.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include <library/cpp/testing/gtest/gtest.h>
#include <gtest/gtest.h>

#include <library/cpp/yt/coding/varint.h>

#include <util/random/random.h>

#include <util/stream/str.h>

#include <util/string/escape.h>

#include <tuple>
Expand Down
2 changes: 1 addition & 1 deletion library/cpp/yt/coding/unittests/zig_zag_ut.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <library/cpp/testing/gtest/gtest.h>
#include <gtest/gtest.h>

#include <library/cpp/yt/coding/zig_zag.h>

Expand Down
21 changes: 21 additions & 0 deletions library/cpp/yt/containers/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
add_ydb_test(NAME yt-containers-enum_indexed_array_ut GTEST
SOURCES
enum_indexed_array_ut.cpp
LINK_LIBRARIES
yt-containers
yt-string
GTest::gtest_main
LABELS
unit
)

add_ydb_test(NAME yt-containers-sharded_set_ut GTEST
SOURCES
sharded_set_ut.cpp
LINK_LIBRARIES
yt-containers
yt-string
GTest::gtest_main
LABELS
unit
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <library/cpp/testing/gtest/gtest.h>
#include <gtest/gtest.h>

#include <library/cpp/yt/containers/enum_indexed_array.h>

Expand Down Expand Up @@ -42,4 +42,3 @@ TEST(TEnumIndexedArrayTest, Simple)

} // namespace
} // namespace NYT

2 changes: 1 addition & 1 deletion library/cpp/yt/containers/unittests/sharded_set_ut.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <library/cpp/yt/containers/sharded_set.h>

#include <library/cpp/testing/gtest/gtest.h>
#include <gtest/gtest.h>

#include <random>

Expand Down
Loading
Loading