mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 00:31:14 +00:00
Add test coverage for --channel-config name selector
This commit is contained in:
parent
ce4584b3d8
commit
cb4335e59f
|
@ -217,6 +217,7 @@ add_testsuite(Properties
|
||||||
SOURCES
|
SOURCES
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/runner.cxx
|
${CMAKE_CURRENT_BINARY_DIR}/runner.cxx
|
||||||
properties/_properties.cxx
|
properties/_properties.cxx
|
||||||
|
properties/_suboptparser.cxx
|
||||||
|
|
||||||
LINKS FairMQ
|
LINKS FairMQ
|
||||||
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
|
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
|
36
test/properties/_suboptparser.cxx
Normal file
36
test/properties/_suboptparser.cxx
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/********************************************************************************
|
||||||
|
* Copyright (C) 2021 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
||||||
|
* *
|
||||||
|
* This software is distributed under the terms of the *
|
||||||
|
* GNU Lesser General Public Licence (LGPL) version 3, *
|
||||||
|
* copied verbatim in the file "LICENSE" *
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
#include <fairmq/Properties.h>
|
||||||
|
#include <fairmq/SuboptParser.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace fair::mq;
|
||||||
|
|
||||||
|
auto contains(Properties const& parsed, string_view key, string_view value) -> bool
|
||||||
|
{
|
||||||
|
return PropertyHelper::ConvertPropertyToString(parsed.at(string(key))) == value;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SuboptParser, ChannelNameSelector)
|
||||||
|
{
|
||||||
|
Properties parsed(SuboptParser({"name=foo-data,address=tcp://0.0.0.0:6000,type=push",
|
||||||
|
"bar-data:address=tcp://0.0.0.0:7000,type=pull"},
|
||||||
|
"foo"));
|
||||||
|
ASSERT_TRUE(contains(parsed, "chans.foo-data.0.address", "tcp://0.0.0.0:6000"));
|
||||||
|
ASSERT_TRUE(contains(parsed, "chans.foo-data.0.type", "push"));
|
||||||
|
ASSERT_TRUE(contains(parsed, "chans.bar-data.0.address", "tcp://0.0.0.0:7000"));
|
||||||
|
ASSERT_TRUE(contains(parsed, "chans.bar-data.0.type", "pull"));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
Loading…
Reference in New Issue
Block a user