Skip to content

Commit

Permalink
gcc9 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackZork committed Jun 2, 2024
1 parent 8ebc104 commit 1e0684e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion libmodmqttsrv/modmqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ ModMqtt::initObjects(const YAML::Node& config, const ModMqtt::ModbusInitData& mo
ConfigTools::readOptionalValue<std::vector<std::pair<int, int>>>(slaves, objdata, "slave");
// default undefined slave - register address must contain slave id
if (slaves.size() == 0)
slaves.push_back(std::pair(-1, -1));
slaves.push_back(std::pair<int,int>(-1, -1));

for(const std::string& defaultNetwork: networks) {

Expand Down
18 changes: 9 additions & 9 deletions unittests/yaml_converters_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ TEST_CASE ("number list string should") {
SECTION("be parsed as single number") {
YAML::Node node = YAML::Load("4");
pairs lst = node.as<pairs>();
REQUIRE(lst[0] == std::pair(4,4));
REQUIRE(lst[0] == std::pair<int,int>(4,4));
}

SECTION("be parsed as single number with spaces ignored") {
YAML::Node node = YAML::Load(" 4");
pairs lst = node.as<pairs>();
REQUIRE(lst[0] == std::pair(4,4));
REQUIRE(lst[0] == std::pair<int,int>(4,4));
}

SECTION("fail if value is not a number") {
Expand All @@ -58,23 +58,23 @@ TEST_CASE ("number list string should") {
SECTION("be parsed as list of number separated by comma") {
YAML::Node node = YAML::Load("4,5");
pairs lst = node.as<pairs>();
REQUIRE(lst[0] == std::pair(4,4));
REQUIRE(lst[1] == std::pair(5,5));
REQUIRE(lst[0] == std::pair<int,int>(4,4));
REQUIRE(lst[1] == std::pair<int,int>(5,5));
}

SECTION("be parsed as list of number ranges separated by comma") {
YAML::Node node = YAML::Load("4-6,5-18");
pairs lst = node.as<pairs>();
REQUIRE(lst[0] == std::pair(4,6));
REQUIRE(lst[1] == std::pair(5,18));
REQUIRE(lst[0] == std::pair<int,int>(4,6));
REQUIRE(lst[1] == std::pair<int,int>(5,18));
}

SECTION("should ignore spaces") {
YAML::Node node = YAML::Load(" 4, 5-18, 7");
pairs lst = node.as<pairs>();
REQUIRE(lst[0] == std::pair(4,4));
REQUIRE(lst[1] == std::pair(5,18));
REQUIRE(lst[2] == std::pair(7,7));
REQUIRE(lst[0] == std::pair<int,int>(4,4));
REQUIRE(lst[1] == std::pair<int,int>(5,18));
REQUIRE(lst[2] == std::pair<int,int>(7,7));
}

}
Expand Down

0 comments on commit 1e0684e

Please sign in to comment.