aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/deprecated/json/writer_ut.cpp
blob: 1f9fc8f39333b1bca76ee6b880ba51abe6b01340 (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
#include "writer.h"

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

using namespace NMonitoring;

Y_UNIT_TEST_SUITE(JsonWriterTests) {
    Y_UNIT_TEST(One) {
        TStringStream ss;
        TDeprecatedJsonWriter w(&ss);
        w.OpenDocument();
        w.OpenMetrics();

        for (int i = 0; i < 5; ++i) {
            w.OpenMetric();
            w.OpenLabels();
            w.WriteLabel("user", TString("") + (char)('a' + i));
            w.WriteLabel("name", "NWrites");
            w.CloseLabels();
            if (i % 2 == 0) {
                w.WriteModeDeriv();
            }
            w.WriteValue(10l);
            w.CloseMetric();
        }

        w.CloseMetrics();
        w.CloseDocument();

        //Cout << ss.Str() << "\n";
    }
}