summaryrefslogtreecommitdiffstats
path: root/yql/essentials/utils/log/log_ut.h
blob: 7358b1d7c5a9f4953b75a2352b952bda1b7c540c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once

#include "format.h"

#include <yql/essentials/utils/log/ut/log_parser.h>

#define Y_UNIT_TEST_ON_EACH_LOG_FORMAT(N)                                                             \
    template <TLogRow (*ParseLogRow)(TStringBuf str), TString (*Format)(const TLogRecord&)>           \
    void N(NUnitTest::TTestContext&);                                                                 \
    struct TTestRegistration##N {                                                                     \
        TTestRegistration##N() {                                                                      \
            TCurrentTest::AddTest(                                                                    \
                #N "Json",                                                                            \
                static_cast<void (*)(NUnitTest::TTestContext&)>(&N<ParseJsonLogRow, JsonFormat>),     \
                /* forceFork = */ false);                                                             \
            TCurrentTest::AddTest(                                                                    \
                #N "Legacy",                                                                          \
                static_cast<void (*)(NUnitTest::TTestContext&)>(&N<ParseLegacyLogRow, LegacyFormat>), \
                /* forceFork = */ false);                                                             \
        }                                                                                             \
    };                                                                                                \
    static TTestRegistration##N testRegistration##N;                                                  \
    template <TLogRow (*ParseLogRow)(TStringBuf str), TString (*Format)(const TLogRecord&)>           \
    void N(NUnitTest::TTestContext&)