diff options
author | bulatman <bulatman@yandex-team.ru> | 2022-02-10 16:45:50 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:50 +0300 |
commit | 2f6ca198245aeffd5e2d82b65927c2465b68b4f5 (patch) | |
tree | 9142afc54d335ea52910662635b898e79e192e49 /library/cpp/testing/gtest_extensions/ut | |
parent | 6560e4993b14d193f8c879e33a3de5e5eba6e21d (diff) | |
download | ydb-2f6ca198245aeffd5e2d82b65927c2465b68b4f5.tar.gz |
Restoring authorship annotation for <bulatman@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/testing/gtest_extensions/ut')
3 files changed, 63 insertions, 63 deletions
diff --git a/library/cpp/testing/gtest_extensions/ut/gtest_extensions_ut.cpp b/library/cpp/testing/gtest_extensions/ut/gtest_extensions_ut.cpp index 7fb0fd7a21..81cdfd0427 100644 --- a/library/cpp/testing/gtest_extensions/ut/gtest_extensions_ut.cpp +++ b/library/cpp/testing/gtest_extensions/ut/gtest_extensions_ut.cpp @@ -52,7 +52,7 @@ std::pair<bool, std::string> Match(T&& t, M&& m) { } TEST(Matchers, Throws) { - auto matcher = testing::Throws<std::runtime_error>(); + auto matcher = testing::Throws<std::runtime_error>(); { std::stringstream ss; @@ -78,7 +78,7 @@ TEST(Matchers, Throws) { { auto [matched, explanation] = Match([]() { throw 10; }, matcher); EXPECT_FALSE(matched); - EXPECT_THAT(explanation, testing::HasSubstr("throws an exception of an unknown type")); + EXPECT_THAT(explanation, testing::HasSubstr("throws an exception of an unknown type")); } { @@ -89,7 +89,7 @@ TEST(Matchers, Throws) { } TEST(Matchers, ThrowsMessage) { - auto matcher = testing::ThrowsMessage<std::runtime_error>(testing::HasSubstr("error message")); + auto matcher = testing::ThrowsMessage<std::runtime_error>(testing::HasSubstr("error message")); { std::stringstream ss; @@ -122,7 +122,7 @@ TEST(Matchers, ThrowsMessage) { { auto [matched, explanation] = Match([]() { throw 10; }, matcher); EXPECT_FALSE(matched); - EXPECT_THAT(explanation, testing::HasSubstr("throws an exception of an unknown type")); + EXPECT_THAT(explanation, testing::HasSubstr("throws an exception of an unknown type")); } { @@ -133,7 +133,7 @@ TEST(Matchers, ThrowsMessage) { } TEST(Matchers, ThrowsMessageHasSubstr) { - auto matcher = testing::ThrowsMessage<std::runtime_error>(testing::HasSubstr("error message")); + auto matcher = testing::ThrowsMessage<std::runtime_error>(testing::HasSubstr("error message")); { std::stringstream ss; @@ -166,7 +166,7 @@ TEST(Matchers, ThrowsMessageHasSubstr) { { auto [matched, explanation] = Match([]() { throw 10; }, matcher); EXPECT_FALSE(matched); - EXPECT_THAT(explanation, testing::HasSubstr("throws an exception of an unknown type")); + EXPECT_THAT(explanation, testing::HasSubstr("throws an exception of an unknown type")); } { @@ -177,7 +177,7 @@ TEST(Matchers, ThrowsMessageHasSubstr) { } TEST(Matchers, ThrowsCondition) { - auto matcher = testing::Throws<std::runtime_error>( + auto matcher = testing::Throws<std::runtime_error>( testing::Property(&std::exception::what, testing::HasSubstr("error message"))); { @@ -212,7 +212,7 @@ TEST(Matchers, ThrowsCondition) { { auto [matched, explanation] = Match([]() { throw 10; }, matcher); EXPECT_FALSE(matched); - EXPECT_THAT(explanation, testing::HasSubstr("throws an exception of an unknown type")); + EXPECT_THAT(explanation, testing::HasSubstr("throws an exception of an unknown type")); } { diff --git a/library/cpp/testing/gtest_extensions/ut/probe_ut.cpp b/library/cpp/testing/gtest_extensions/ut/probe_ut.cpp index 428f313b9e..a9d53f896a 100644 --- a/library/cpp/testing/gtest_extensions/ut/probe_ut.cpp +++ b/library/cpp/testing/gtest_extensions/ut/probe_ut.cpp @@ -1,54 +1,54 @@ -#include <library/cpp/testing/gtest/gtest.h> - -using namespace testing; - -TEST(ProbeStateTest, Example) { - // check that our test function does not make a copy of passed argument - auto copyless = [](auto&& x) { - TProbe p(std::move(x)); - p.Touch(); - return p; - }; - - TProbeState state; - auto probe = copyless(TProbe(&state)); - EXPECT_EQ(1, state.Touches); - EXPECT_THAT(state, HasCopyMoveCounts(0, 2)); -} - -TEST(ProbeTest, Construct) { - TProbeState state; - { - TProbe probe(&state); - EXPECT_THAT(state, IsAlive()); - } - EXPECT_THAT(state, IsDead()); -} - -TEST(ProbeTest, Copy) { - TProbeState state; - - TProbe probe(&state); - TProbe copy(probe); - EXPECT_THAT(state, HasCopyMoveCounts(1, 0)); - EXPECT_THAT(state, NoAssignments()); - EXPECT_THAT(state, NoMoves()); - - TProbe copy2 = TProbe::ExplicitlyCreateInvalidProbe(); - copy2 = probe; - EXPECT_EQ(1, state.CopyAssignments); -} - -TEST(ProbeTest, Move) { - TProbeState state; - TProbe probe(&state); - TProbe probe2(std::move(probe)); - EXPECT_FALSE(probe.IsValid()); - EXPECT_THAT(state, NoCopies()); - - EXPECT_THAT(state, HasCopyMoveCounts(0, 1)); - - TProbe probe3 = TProbe::ExplicitlyCreateInvalidProbe(); - probe3 = std::move(probe2); - EXPECT_EQ(1, state.MoveAssignments); -} +#include <library/cpp/testing/gtest/gtest.h> + +using namespace testing; + +TEST(ProbeStateTest, Example) { + // check that our test function does not make a copy of passed argument + auto copyless = [](auto&& x) { + TProbe p(std::move(x)); + p.Touch(); + return p; + }; + + TProbeState state; + auto probe = copyless(TProbe(&state)); + EXPECT_EQ(1, state.Touches); + EXPECT_THAT(state, HasCopyMoveCounts(0, 2)); +} + +TEST(ProbeTest, Construct) { + TProbeState state; + { + TProbe probe(&state); + EXPECT_THAT(state, IsAlive()); + } + EXPECT_THAT(state, IsDead()); +} + +TEST(ProbeTest, Copy) { + TProbeState state; + + TProbe probe(&state); + TProbe copy(probe); + EXPECT_THAT(state, HasCopyMoveCounts(1, 0)); + EXPECT_THAT(state, NoAssignments()); + EXPECT_THAT(state, NoMoves()); + + TProbe copy2 = TProbe::ExplicitlyCreateInvalidProbe(); + copy2 = probe; + EXPECT_EQ(1, state.CopyAssignments); +} + +TEST(ProbeTest, Move) { + TProbeState state; + TProbe probe(&state); + TProbe probe2(std::move(probe)); + EXPECT_FALSE(probe.IsValid()); + EXPECT_THAT(state, NoCopies()); + + EXPECT_THAT(state, HasCopyMoveCounts(0, 1)); + + TProbe probe3 = TProbe::ExplicitlyCreateInvalidProbe(); + probe3 = std::move(probe2); + EXPECT_EQ(1, state.MoveAssignments); +} diff --git a/library/cpp/testing/gtest_extensions/ut/ya.make b/library/cpp/testing/gtest_extensions/ut/ya.make index ca333b4905..39b41cecfd 100644 --- a/library/cpp/testing/gtest_extensions/ut/ya.make +++ b/library/cpp/testing/gtest_extensions/ut/ya.make @@ -10,7 +10,7 @@ OWNER( SRCS( gtest_extensions_ut.cpp - probe_ut.cpp + probe_ut.cpp ) PEERDIR( |