Skip to content
Merged
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
35 changes: 1 addition & 34 deletions ydb/core/kqp/ut/common/kqp_ut_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <ydb/public/sdk/cpp/include/ydb-cpp-sdk/client/scheme/scheme.h>
#include <ydb/public/sdk/cpp/include/ydb-cpp-sdk/client/table/table.h>

#include <ydb/library/testlib/helpers.h>
#include <library/cpp/yson/node/node_io.h>
#include <library/cpp/json/json_reader.h>
#include <library/cpp/testing/unittest/tests_data.h>
Expand All @@ -19,40 +20,6 @@
#include <library/cpp/threading/future/async.h>


#define Y_UNIT_TEST_TWIN(N, OPT) \
template <bool OPT> \
struct TTestCase##N : public TCurrentTestCase { \
TTestCase##N() : TCurrentTestCase() { \
if constexpr (OPT) { Name_ = #N "+" #OPT; } else { Name_ = #N "-" #OPT; } \
} \
static THolder<NUnitTest::TBaseTestCase> CreateOn() { return ::MakeHolder<TTestCase##N<true>>(); } \
static THolder<NUnitTest::TBaseTestCase> CreateOff() { return ::MakeHolder<TTestCase##N<false>>(); } \
void Execute_(NUnitTest::TTestContext&) override; \
}; \
struct TTestRegistration##N { \
TTestRegistration##N() { \
TCurrentTest::AddTest(TTestCase##N<true>::CreateOn); \
TCurrentTest::AddTest(TTestCase##N<false>::CreateOff); \
} \
}; \
static TTestRegistration##N testRegistration##N; \
template <bool OPT> \
void TTestCase##N<OPT>::Execute_(NUnitTest::TTestContext& ut_context Y_DECLARE_UNUSED)

#define Y_UNIT_TEST_QUAD(N, OPT1, OPT2) \
template<bool OPT1, bool OPT2> void N(NUnitTest::TTestContext&); \
struct TTestRegistration##N { \
TTestRegistration##N() { \
TCurrentTest::AddTest(#N "-" #OPT1 "-" #OPT2, static_cast<void (*)(NUnitTest::TTestContext&)>(&N<false, false>), false); \
TCurrentTest::AddTest(#N "+" #OPT1 "-" #OPT2, static_cast<void (*)(NUnitTest::TTestContext&)>(&N<true, false>), false); \
TCurrentTest::AddTest(#N "-" #OPT1 "+" #OPT2, static_cast<void (*)(NUnitTest::TTestContext&)>(&N<false, true>), false); \
TCurrentTest::AddTest(#N "+" #OPT1 "+" #OPT2, static_cast<void (*)(NUnitTest::TTestContext&)>(&N<true, true>), false); \
} \
}; \
static TTestRegistration##N testRegistration##N; \
template<bool OPT1, bool OPT2> \
void N(NUnitTest::TTestContext&)

template <bool ForceVersionV1>
TString MakeQuery(const TString& tmpl) {
return TStringBuilder()
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/tx/datashard/datashard_ut_order.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <ydb/core/base/blobstorage_common.h>
#include <ydb/core/engine/minikql/minikql_engine_host.h>
#include <ydb/core/kqp/executer_actor/kqp_executer.h>
#include <ydb/core/kqp/ut/common/kqp_ut_common.h> // Y_UNIT_TEST_(TWIN|QUAD)
#include <ydb/library/testlib/helpers.h>
#include <ydb/core/tx/time_cast/time_cast.h>
#include <ydb/core/tx/tx_proxy/proxy.h>
#include <ydb/core/tx/tx_processing.h>
Expand Down
39 changes: 39 additions & 0 deletions ydb/library/testlib/helpers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#pragma once

#include <library/cpp/testing/unittest/registar.h>

#define Y_UNIT_TEST_TWIN(N, OPT) \
template <bool OPT> \
struct TTestCase##N : public TCurrentTestCase { \
TTestCase##N() : TCurrentTestCase() { \
if constexpr (OPT) { Name_ = #N "+" #OPT; } else { Name_ = #N "-" #OPT; } \
} \
static THolder<NUnitTest::TBaseTestCase> CreateOn() { return ::MakeHolder<TTestCase##N<true>>(); } \
static THolder<NUnitTest::TBaseTestCase> CreateOff() { return ::MakeHolder<TTestCase##N<false>>(); } \
void Execute_(NUnitTest::TTestContext&) override; \
}; \
struct TTestRegistration##N { \
TTestRegistration##N() { \
TCurrentTest::AddTest(TTestCase##N<true>::CreateOn); \
TCurrentTest::AddTest(TTestCase##N<false>::CreateOff); \
} \
}; \
static TTestRegistration##N testRegistration##N; \
template <bool OPT> \
void TTestCase##N<OPT>::Execute_(NUnitTest::TTestContext& ut_context Y_DECLARE_UNUSED)

#define Y_UNIT_TEST_QUAD(N, OPT1, OPT2) \
template<bool OPT1, bool OPT2> void N(NUnitTest::TTestContext&); \
struct TTestRegistration##N { \
TTestRegistration##N() { \
TCurrentTest::AddTest(#N "-" #OPT1 "-" #OPT2, static_cast<void (*)(NUnitTest::TTestContext&)>(&N<false, false>), false); \
TCurrentTest::AddTest(#N "+" #OPT1 "-" #OPT2, static_cast<void (*)(NUnitTest::TTestContext&)>(&N<true, false>), false); \
TCurrentTest::AddTest(#N "-" #OPT1 "+" #OPT2, static_cast<void (*)(NUnitTest::TTestContext&)>(&N<false, true>), false); \
TCurrentTest::AddTest(#N "+" #OPT1 "+" #OPT2, static_cast<void (*)(NUnitTest::TTestContext&)>(&N<true, true>), false); \
} \
}; \
static TTestRegistration##N testRegistration##N; \
template<bool OPT1, bool OPT2> \
void N(NUnitTest::TTestContext&)


Loading