diff options
| author | bulatman <[email protected]> | 2022-02-10 16:45:50 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:45:50 +0300 | 
| commit | 2f6ca198245aeffd5e2d82b65927c2465b68b4f5 (patch) | |
| tree | 9142afc54d335ea52910662635b898e79e192e49 /library/cpp/testing/unittest | |
| parent | 6560e4993b14d193f8c879e33a3de5e5eba6e21d (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/testing/unittest')
| -rw-r--r-- | library/cpp/testing/unittest/env.h | 4 | ||||
| -rw-r--r-- | library/cpp/testing/unittest/plugin.h | 2 | ||||
| -rw-r--r-- | library/cpp/testing/unittest/tests_data.cpp | 70 | ||||
| -rw-r--r-- | library/cpp/testing/unittest/tests_data.h | 6 | ||||
| -rw-r--r-- | library/cpp/testing/unittest/utmain.cpp | 24 | ||||
| -rw-r--r-- | library/cpp/testing/unittest/ya.make | 14 | 
6 files changed, 60 insertions, 60 deletions
diff --git a/library/cpp/testing/unittest/env.h b/library/cpp/testing/unittest/env.h index ed4236e314f..4807539ab28 100644 --- a/library/cpp/testing/unittest/env.h +++ b/library/cpp/testing/unittest/env.h @@ -1,3 +1,3 @@ -// just shortcut  -#include <library/cpp/testing/common/env.h>  +// just shortcut +#include <library/cpp/testing/common/env.h> diff --git a/library/cpp/testing/unittest/plugin.h b/library/cpp/testing/unittest/plugin.h index abf70764d43..102f2c1469e 100644 --- a/library/cpp/testing/unittest/plugin.h +++ b/library/cpp/testing/unittest/plugin.h @@ -3,7 +3,7 @@  #include <util/generic/ptr.h>  namespace NUnitTest { -    // Plugins are deprecated, please use Y_TEST_HOOK_* from library/cpp/hook/hook.h  +    // Plugins are deprecated, please use Y_TEST_HOOK_* from library/cpp/hook/hook.h      namespace NPlugin {          class IPlugin {          public: diff --git a/library/cpp/testing/unittest/tests_data.cpp b/library/cpp/testing/unittest/tests_data.cpp index d7c7a40a0f5..b51cbc4b87c 100644 --- a/library/cpp/testing/unittest/tests_data.cpp +++ b/library/cpp/testing/unittest/tests_data.cpp @@ -1,59 +1,59 @@  #include "tests_data.h"  #include "registar.h" -#include <library/cpp/testing/common/network.h>  +#include <library/cpp/testing/common/network.h> + +#include <util/system/env.h> +#include <util/system/mutex.h> -#include <util/system/env.h>  -#include <util/system/mutex.h>  -   class TPortManager::TPortManagerImpl {  public: -    TPortManagerImpl(bool reservePortsForCurrentTest)  -        : EnableReservePortsForCurrentTest(reservePortsForCurrentTest)  -        , DisableRandomPorts(!GetEnv("NO_RANDOM_PORTS").empty())  +    TPortManagerImpl(bool reservePortsForCurrentTest) +        : EnableReservePortsForCurrentTest(reservePortsForCurrentTest) +        , DisableRandomPorts(!GetEnv("NO_RANDOM_PORTS").empty())      {      }      ui16 GetPort(ui16 port) { -        if (port && DisableRandomPorts) {  +        if (port && DisableRandomPorts) {              return port;          } -        TAtomicSharedPtr<NTesting::IPort> holder(NTesting::GetFreePort().Release());  -        ReservePortForCurrentTest(holder);  +        TAtomicSharedPtr<NTesting::IPort> holder(NTesting::GetFreePort().Release()); +        ReservePortForCurrentTest(holder); -        TGuard<TMutex> g(Lock);  -        ReservedPorts.push_back(holder);  -        return holder->Get();  -    }  +        TGuard<TMutex> g(Lock); +        ReservedPorts.push_back(holder); +        return holder->Get(); +    } -    ui16 GetUdpPort(ui16 port) {  -        return GetPort(port);  -    }  +    ui16 GetUdpPort(ui16 port) { +        return GetPort(port); +    } -    ui16 GetTcpPort(ui16 port) {  -        return GetPort(port);  +    ui16 GetTcpPort(ui16 port) { +        return GetPort(port);      }      ui16 GetTcpAndUdpPort(ui16 port) { -        return GetPort(port);  +        return GetPort(port);      }      ui16 GetPortsRange(const ui16 startPort, const ui16 range) { -        Y_UNUSED(startPort);  -        auto ports = NTesting::NLegacy::GetFreePortsRange(range);  -        ui16 first = ports[0];  +        Y_UNUSED(startPort); +        auto ports = NTesting::NLegacy::GetFreePortsRange(range); +        ui16 first = ports[0];          TGuard<TMutex> g(Lock); -        for (auto& port : ports) {  -            ReservedPorts.emplace_back(port.Release());  -            ReservePortForCurrentTest(ReservedPorts.back());  +        for (auto& port : ports) { +            ReservedPorts.emplace_back(port.Release()); +            ReservePortForCurrentTest(ReservedPorts.back());          } -        return first;  +        return first;      }  private: -    void ReservePortForCurrentTest(const TAtomicSharedPtr<NTesting::IPort>& portGuard) {  -        if (EnableReservePortsForCurrentTest) {  +    void ReservePortForCurrentTest(const TAtomicSharedPtr<NTesting::IPort>& portGuard) { +        if (EnableReservePortsForCurrentTest) {              TTestBase* currentTest = NUnitTest::NPrivate::GetCurrentTest();              if (currentTest != nullptr) {                  currentTest->RunAfterTest([guard = portGuard]() mutable { @@ -65,13 +65,13 @@ private:  private:      TMutex Lock; -    TVector<TAtomicSharedPtr<NTesting::IPort>> ReservedPorts;  -    const bool EnableReservePortsForCurrentTest;  -    const bool DisableRandomPorts;  +    TVector<TAtomicSharedPtr<NTesting::IPort>> ReservedPorts; +    const bool EnableReservePortsForCurrentTest; +    const bool DisableRandomPorts;  }; -TPortManager::TPortManager(bool reservePortsForCurrentTest)  -    : Impl_(new TPortManagerImpl(reservePortsForCurrentTest))  +TPortManager::TPortManager(bool reservePortsForCurrentTest) +    : Impl_(new TPortManagerImpl(reservePortsForCurrentTest))  {  } @@ -99,6 +99,6 @@ ui16 TPortManager::GetPortsRange(const ui16 startPort, const ui16 range) {  }  ui16 GetRandomPort() { -    TPortManager* pm = Singleton<TPortManager>(false);  +    TPortManager* pm = Singleton<TPortManager>(false);      return pm->GetPort();  } diff --git a/library/cpp/testing/unittest/tests_data.h b/library/cpp/testing/unittest/tests_data.h index ff542d2c64d..6536bc1ae69 100644 --- a/library/cpp/testing/unittest/tests_data.h +++ b/library/cpp/testing/unittest/tests_data.h @@ -1,7 +1,7 @@  #pragma once -#include <library/cpp/testing/common/env.h>  -  +#include <library/cpp/testing/common/env.h> +  #include <util/generic/noncopyable.h>  #include <util/generic/ptr.h>  #include <util/generic/string.h> @@ -29,7 +29,7 @@ void SetReuseAddressAndPort(const TSocketType& sock) {  class TPortManager: public TNonCopyable {  public: -    TPortManager(bool reservePortsForCurrentTest = true);  +    TPortManager(bool reservePortsForCurrentTest = true);      ~TPortManager();      // Gets free TCP port diff --git a/library/cpp/testing/unittest/utmain.cpp b/library/cpp/testing/unittest/utmain.cpp index a5b74ee8012..305bc6b40fc 100644 --- a/library/cpp/testing/unittest/utmain.cpp +++ b/library/cpp/testing/unittest/utmain.cpp @@ -7,13 +7,13 @@  #include <library/cpp/json/writer/json.h>  #include <library/cpp/json/writer/json_value.h>  #include <library/cpp/testing/common/env.h> -#include <library/cpp/testing/hook/hook.h>  +#include <library/cpp/testing/hook/hook.h>  #include <util/datetime/base.h>  #include <util/generic/hash.h>  #include <util/generic/hash_set.h> -#include <util/generic/scope.h>  +#include <util/generic/scope.h>  #include <util/generic/string.h>  #include <util/generic/yexception.h> @@ -647,7 +647,7 @@ int NUnitTest::RunMain(int argc, char** argv) {          Y_VERIFY(!sigaction(SIGUSR2, &sa, nullptr));      }  #endif -    NTesting::THook::CallBeforeInit();  +    NTesting::THook::CallBeforeInit();      InitNetworkSubSystem();      try { @@ -658,11 +658,11 @@ int NUnitTest::RunMain(int argc, char** argv) {  #ifndef UT_SKIP_EXCEPTIONS      try {  #endif -        NTesting::THook::CallBeforeRun();  -        Y_DEFER { NTesting::THook::CallAfterRun(); };  -  +        NTesting::THook::CallBeforeRun(); +        Y_DEFER { NTesting::THook::CallAfterRun(); }; +          NPlugin::OnStartMain(argc, argv); -        Y_DEFER { NPlugin::OnStopMain(argc, argv); };  +        Y_DEFER { NPlugin::OnStopMain(argc, argv); };          TColoredProcessor processor(GetExecPath());          IOutputStream* listStream = &Cout; @@ -749,18 +749,18 @@ int NUnitTest::RunMain(int argc, char** argv) {          TTestFactory::Instance().SetProcessor(&processor); -        unsigned ret;  +        unsigned ret;          for (;;) { -            ret = TTestFactory::Instance().Execute();  +            ret = TTestFactory::Instance().Execute();              if (!processor.GetIsForked() && ret && processor.GetPrintSummary()) {                  Cerr << "SOME TESTS FAILED!!!!" << Endl;              } -            if (0 != ret || !processor.IsLoop()) {  -                break;  +            if (0 != ret || !processor.IsLoop()) { +                break;              }          } -        return ret;  +        return ret;  #ifndef UT_SKIP_EXCEPTIONS      } catch (...) {          Cerr << "caught exception in test suite(" << CurrentExceptionMessage() << ")" << Endl; diff --git a/library/cpp/testing/unittest/ya.make b/library/cpp/testing/unittest/ya.make index f291fec2cbe..aaa4f2ba851 100644 --- a/library/cpp/testing/unittest/ya.make +++ b/library/cpp/testing/unittest/ya.make @@ -12,8 +12,8 @@ PEERDIR(      library/cpp/dbg_output      library/cpp/diff      library/cpp/json/writer -    library/cpp/testing/common  -    library/cpp/testing/hook  +    library/cpp/testing/common +    library/cpp/testing/hook  )  SRCS( @@ -26,8 +26,8 @@ SRCS(  )  END() -  -RECURSE_FOR_TESTS(  -    fat  -    ut  -)  + +RECURSE_FOR_TESTS( +    fat +    ut +)  | 
