Skip to content

Commit

Permalink
enh(common/tests): new test on perfdata parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
bouda1 committed Nov 20, 2024
1 parent 1bb5eb9 commit 84085b1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions common/tests/perfdata_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -623,3 +623,18 @@ TEST_F(PerfdataParser, BadMetric1) {
++i;
}
}

TEST_F(PerfdataParser, ExtractPerfdataBrackets) {
std::string perfdata(
"'xx[aa a aa]'=2;3;7;1;9 '[a aa]'=12;25;50;0;118 'aa a]'=28;13;54;0;80");
auto lst{common::perfdata::parse_perfdata(0, 0, perfdata.c_str(), _logger)};
auto it = lst.begin();
ASSERT_NE(it, lst.end());
ASSERT_EQ(it->name(), "xx[aa a aa]");
++it;
ASSERT_NE(it, lst.end());
ASSERT_EQ(it->name(), "[a aa]");
++it;
ASSERT_NE(it, lst.end());
ASSERT_EQ(it->name(), "aa a]");
}

0 comments on commit 84085b1

Please sign in to comment.