LCOV - code coverage report
Current view: top level - ers/test/apps - ers_schema_test.cxx (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 26 0
Test Date: 2025-12-21 13:07:08 Functions: 0.0 % 10 0

            Line data    Source code
       1              : #include "ers/Schema.hpp"
       2              : #include <google/protobuf/util/json_util.h>
       3              : 
       4              : #include <boost/asio/ip/host_name.hpp>
       5              : 
       6              : #include <chrono>
       7              : #include <cstdlib>
       8              : #include <iostream>
       9              : #include <string>
      10              : 
      11              : using namespace std;
      12              : using namespace google::protobuf::util;
      13              : 
      14              : using namespace dunedaq::ersschema;
      15              : 
      16              : #include "ers/ers.hpp"
      17              : 
      18            0 : ERS_DECLARE_ISSUE(ersschema, TestIssue, "this is issue with ID: " << id, ((int)id))
      19              : 
      20              : int
      21            0 : main(int argc, char* argv[])
      22              : {
      23              : 
      24            0 :   GOOGLE_PROTOBUF_VERIFY_VERSION;
      25              : 
      26            0 :   ersschema::TestIssue first(ERS_HERE, 0);
      27            0 :   ersschema::TestIssue second(ERS_HERE, 1, first);
      28            0 :   ersschema::TestIssue third(ERS_HERE, 2, second);
      29              : 
      30            0 :   dunedaq::ersschema::IssueChain schema;
      31            0 :   to_schema(third, schema);
      32            0 :   schema.set_session("None");
      33            0 :   schema.set_application("ers_schema_test");
      34              : 
      35            0 :   JsonPrintOptions opt;
      36            0 :   opt.add_whitespace = true;
      37            0 :   opt.preserve_proto_field_names = true;
      38              : 
      39            0 :   string json;
      40            0 :   MessageToJsonString(schema, &json, opt);
      41            0 :   cout << json << endl;
      42              : 
      43              :   // google::protobuf::Timestamp time;
      44              :   // time.set_seconds( chrono::system_clock::now().time_since_epoch().count() );
      45              :   // (*issue.mutable_time())=time;
      46              : 
      47            0 :   string serial;
      48              : 
      49            0 :   schema.SerializeToString(&serial);
      50              : 
      51            0 :   IssueChain reco;
      52            0 :   reco.ParseFromString(serial.c_str());
      53              : 
      54            0 :   if (schema.final().severity() == reco.final().severity()) {
      55            0 :     cout << "success" << endl;
      56              :   } else {
      57            0 :     cout << "failure" << endl;
      58              :   }
      59              : 
      60              :   // JsonStringToMessage( json, & reco_issue);
      61              : 
      62              :   // if ( issue.name() == reco_issue.name() ) {
      63              :   //   cout << "json success" << endl ;
      64              :   // } else {
      65              :   //   cout << "Jons failure" << endl;
      66              :   // }
      67              : 
      68            0 :   google::protobuf::ShutdownProtobufLibrary();
      69              : 
      70            0 :   return 0;
      71            0 : }
        

Generated by: LCOV version 2.0-1