aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/tvmauth/client/ut/logger_ut.cpp
blob: 76236e8913b86d1691469bfc95903354a80eb5cc (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "common.h"

#include <library/cpp/tvmauth/client/logger.h>

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

using namespace NTvmAuth;

Y_UNIT_TEST_SUITE(ClientLogger) {
    int i = 0;

    Y_UNIT_TEST(Debug) {
        TLogger l;
        l.Debug("qwerty");
        UNIT_ASSERT_VALUES_EQUAL("7: qwerty\n", l.Stream.Str());
    }

    Y_UNIT_TEST(Info) {
        TLogger l;
        l.Info("qwerty");
        UNIT_ASSERT_VALUES_EQUAL("6: qwerty\n", l.Stream.Str());
    }

    Y_UNIT_TEST(Warning) {
        TLogger l;
        l.Warning("qwerty");
        UNIT_ASSERT_VALUES_EQUAL("4: qwerty\n", l.Stream.Str());
    }

    Y_UNIT_TEST(Error) {
        TLogger l;
        l.Error("qwerty");
        UNIT_ASSERT_VALUES_EQUAL("3: qwerty\n", l.Stream.Str());
    }

#ifdef _unix_
    Y_UNIT_TEST(Cerr_) {
        TCerrLogger l(5);
        l.Error("hit");
        l.Debug("miss");
    }
#endif
}