diff --git a/Tests/BaseLib/TestConfigTree.cpp b/Tests/BaseLib/TestConfigTree.cpp index c97ed98083ad68112464e3e62782e9b52d31824d..71259e6b7a8bcb511f117fede3fc573bbbcd5eb6 100644 --- a/Tests/BaseLib/TestConfigTree.cpp +++ b/Tests/BaseLib/TestConfigTree.cpp @@ -11,7 +11,9 @@ #include <logog/include/logog.hpp> #include <boost/property_tree/xml_parser.hpp> +#include <numeric> #include <sstream> +#include <vector> #include "BaseLib/ConfigTree.h" #include "Tests/TestTools.h" @@ -114,6 +116,7 @@ TEST(BaseLibConfigTree, Get) "</sub>" "<x>Y</x>" "<z attr=\"0.5\" optattr=\"false\">32.0</z>" + "<vector>0 1 2 3 4</vector>" ; auto const ptree = readXml(xml); @@ -219,6 +222,17 @@ TEST(BaseLibConfigTree, Get) EXPECT_FALSE(z.getConfAttributeOptional<bool>("also_not_an_attr")); // nonexisting attribute EXPECT_ERR_WARN(cbs, false, false); } + + // Testing vector + { + auto v = conf.getConfParam<std::vector<int>>("vector"); + EXPECT_ERR_WARN(cbs, false, false); + EXPECT_EQ(5u, v.size()); + std::vector<int> expected_vector(5); + std::iota(expected_vector.begin(), expected_vector.end(), 0); + EXPECT_TRUE(std::equal(expected_vector.begin(), + expected_vector.end(), v.begin())); + } EXPECT_ERR_WARN(cbs, false, false); } // ConfigTree destroyed here EXPECT_ERR_WARN(cbs, false, false);