1 | #include <Common/getMultipleKeysFromConfig.h> |
2 | #include <Poco/AutoPtr.h> |
3 | #include <Poco/Util/XMLConfiguration.h> |
4 | |
5 | #include <gtest/gtest.h> |
6 | |
7 | |
8 | using namespace DB; |
9 | |
10 | TEST(Common, getMultipleValuesFromConfig) |
11 | { |
12 | std::istringstream xml_isteam(R"END(<?xml version="1.0"?> |
13 | <yandex> |
14 | <first_level> |
15 | <second_level>0</second_level> |
16 | <second_level>1</second_level> |
17 | <second_level>2</second_level> |
18 | <second_level>3</second_level> |
19 | </first_level> |
20 | </yandex>)END" ); |
21 | |
22 | Poco::AutoPtr<Poco::Util::XMLConfiguration> config = new Poco::Util::XMLConfiguration(xml_isteam); |
23 | std::vector<std::string> answer = getMultipleValuesFromConfig(*config, "first_level" , "second_level" ); |
24 | std::vector<std::string> right_answer = {"0" , "1" , "2" , "3" }; |
25 | EXPECT_EQ(answer, right_answer); |
26 | } |
27 | |