aboutsummaryrefslogblamecommitdiffstats
path: root/library/cpp/monlib/deprecated/json/writer_ut.cpp
blob: 1f9fc8f39333b1bca76ee6b880ba51abe6b01340 (plain) (tree)
1
2
3
4
5
6
7
8
9
                   
                                                  
 
                            
 
                                    
                      
                         
                                     
                         
                        
                                     
                           
                           
                                                                



                                   
                            
         
                         



                                   
#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";
    }
}