@@ -10,20 +10,27 @@ namespace o2 {
1010namespace monitoring {
1111namespace Test {
1212
13+ using namespace o2 ::monitoring;
14+
1315BOOST_AUTO_TEST_CASE (retrieveOtherParams)
1416{
1517 int value = 10 ;
16- std::string name (" metric name" );
17- o2::monitoring::Metric metricInstance (value, name);
18+ Metric metricInstance (value, " metric name" );
1819
1920 BOOST_CHECK_EQUAL (metricInstance.getName (), " metric name" );
2021}
2122
23+ BOOST_AUTO_TEST_CASE (constCharName)
24+ {
25+ const char * name = " a name" ;
26+ Metric metricInstance (10 , name);
27+ BOOST_CHECK_EQUAL (metricInstance.getName (), " a name" );
28+ }
2229
2330BOOST_AUTO_TEST_CASE (retrieveInt) {
2431 int value = 10 ;
2532 std::string name (" metric name" );
26- o2::monitoring:: Metric metricInstance (value, name );
33+ Metric metricInstance (value, name );
2734
2835 BOOST_CHECK_EQUAL (boost::get<int >(metricInstance.getValue ()), 10 );
2936 BOOST_CHECK_EQUAL (metricInstance.getType (), 0 );
@@ -32,7 +39,7 @@ BOOST_AUTO_TEST_CASE(retrieveInt) {
3239BOOST_AUTO_TEST_CASE (retrieveDouble) {
3340 double value = 1.11 ;
3441 std::string name (" metric name" );
35- o2::monitoring:: Metric metricInstance (value, name );
42+ Metric metricInstance (value, name );
3643
3744 BOOST_CHECK_EQUAL (boost::get<double >(metricInstance.getValue ()), 1.11 );
3845 BOOST_CHECK_EQUAL (metricInstance.getType (), 2 );
@@ -42,7 +49,7 @@ BOOST_AUTO_TEST_CASE(retrieveString)
4249{
4350 std::string value = " testString" ;
4451 std::string name (" metric name" );
45- o2::monitoring:: Metric metricInstance (value, name );
52+ Metric metricInstance (value, name );
4653
4754 BOOST_CHECK_EQUAL (boost::get<std::string>(metricInstance.getValue ()), " testString" );
4855 BOOST_CHECK_EQUAL (metricInstance.getType (), 1 );
@@ -52,7 +59,7 @@ BOOST_AUTO_TEST_CASE(retrieveUnsignedLongLong)
5259{
5360 uint64_t value = 10000000000000LL ;
5461 std::string name (" metric name" );
55- o2::monitoring:: Metric metricInstance (value, name );
62+ Metric metricInstance (value, name );
5663
5764 BOOST_CHECK_EQUAL (boost::get<uint64_t >(metricInstance.getValue ()), 10000000000000LL );
5865 BOOST_CHECK_EQUAL (metricInstance.getType (), 3 );
@@ -63,12 +70,12 @@ bool is_critical(const boost::bad_get&) { return true; }
6370BOOST_AUTO_TEST_CASE (retrieveWrongType) {
6471 double value = 1.11 ;
6572 std::string name (" metric name" );
66- o2::monitoring:: Metric metricInstance (value, name );
73+ Metric metricInstance (value, name );
6774 BOOST_CHECK_EXCEPTION (boost::get<std::string>(metricInstance.getValue ()), boost::bad_get, is_critical);
6875}
6976
7077BOOST_AUTO_TEST_CASE (tags) {
71- o2::monitoring:: Metric metric = Metric{10 , " myMetric" }.addTags ({o2::monitoring::tags::Detector::TPC, o2::monitoring::tags::Detector::TRD});
78+ Metric metric = Metric{10 , " myMetric" }.addTags ({o2::monitoring::tags::Detector::TPC, o2::monitoring::tags::Detector::TRD});
7279 auto tags = metric.getTags ();
7380 int sum = 0 ;
7481 for (auto const & tag: tags) {
@@ -78,8 +85,8 @@ BOOST_AUTO_TEST_CASE(tags) {
7885}
7986
8087BOOST_AUTO_TEST_CASE (customCopyConstructor) {
81- o2::monitoring:: Metric metric = Metric{10 , " myMetric" }.addTags ({o2::monitoring::tags::Detector::TPC, o2::monitoring::tags::Detector::TRD});
82- o2::monitoring:: Metric assigned{1 , " assingedMetric" };
88+ Metric metric = Metric{10 , " myMetric" }.addTags ({o2::monitoring::tags::Detector::TPC, o2::monitoring::tags::Detector::TRD});
89+ Metric assigned{1 , " assingedMetric" };
8390 auto copied = metric;
8491 assigned = metric;
8592 BOOST_CHECK_EQUAL (boost::get<int >(copied.getValue ()), 10 );
0 commit comments