27 #include <boost/assign/list_of.hpp> 28 #include <boost/test/unit_test.hpp> 41 boost::assign::list_of<std::string>(
"ONE")(
"TWO")(
"THREE");
60 BOOST_AUTO_TEST_SUITE(ts_BatchGet)
62 #ifdef ICL_CORE_CONFIG_HAS_ENHANCED_CONFIG_MACROS 86 icl::Nirwana::instance());
87 BOOST_CHECK(read_success);
89 BOOST_CHECK_EQUAL(string_value,
"string-value");
90 BOOST_CHECK_EQUAL(uint32_value,
uint32_t(12345));
91 BOOST_CHECK_EQUAL(double_value,
double(1.2345));
103 icc::setValue(
"/ConfigValueDefault/StringEntry",
"string-value");
111 icl::Nirwana::instance());
112 BOOST_CHECK(read_success);
114 BOOST_CHECK_EQUAL(string_value,
"string-value");
115 BOOST_CHECK_EQUAL(uint32_value,
uint32_t(12345));
136 icl::Nirwana::instance());
137 BOOST_CHECK(read_success);
139 BOOST_CHECK_EQUAL(value1,
ONE);
140 BOOST_CHECK_EQUAL(value2,
TWO);
160 icl::Nirwana::instance());
161 BOOST_CHECK(read_success);
163 BOOST_CHECK_EQUAL(value1,
ONE);
164 BOOST_CHECK_EQUAL(value2,
TWO);
194 icl::Nirwana::instance());
195 BOOST_CHECK(read_success);
197 BOOST_CHECK_EQUAL(string_value,
"string-value");
198 BOOST_CHECK_EQUAL(uint32_value,
uint32_t(12345));
199 BOOST_CHECK_EQUAL(double_value,
double(1.2345));
200 BOOST_CHECK_EQUAL(enum_value,
TWO);
249 icc::setValue(
"/ConfigList/List/Entry1/StringEntry",
"string-value-1");
251 icc::setValue(
"/ConfigList/List/Entry1/Foo/UInt32Entry",
"1");
252 icc::setValue(
"/ConfigList/List/Entry1/Foo/EnumEntry",
"ONE");
253 icc::setValue(
"/ConfigList/List/Entry1/Foo/Bar/DoubleEntry",
"0.1");
254 icc::setValue(
"/ConfigList/List/Entry1/Foo/Bar/EnumEntry",
"ONE");
255 icc::setValue(
"/ConfigList/List/Entry2/StringEntry",
"string-value-2");
257 icc::setValue(
"/ConfigList/List/Entry2/Foo/UInt32Entry",
"2");
258 icc::setValue(
"/ConfigList/List/Entry2/Foo/EnumEntry",
"TWO");
259 icc::setValue(
"/ConfigList/List/Entry2/Foo/Bar/DoubleEntry",
"0.2");
260 icc::setValue(
"/ConfigList/List/Entry2/Foo/Bar/EnumEntry",
"TWO");
261 icc::setValue(
"/ConfigList/List/Entry3/StringEntry",
"string-value-3");
263 icc::setValue(
"/ConfigList/List/Entry3/Foo/UInt32Entry",
"3");
264 icc::setValue(
"/ConfigList/List/Entry3/Foo/EnumEntry",
"THREE");
265 icc::setValue(
"/ConfigList/List/Entry3/Foo/Bar/DoubleEntry",
"0.3");
266 icc::setValue(
"/ConfigList/List/Entry3/Foo/Bar/EnumEntry",
"THREE");
270 std::vector<ConfigListEntry> config_list;
271 bool read_successful =
285 std::back_inserter(config_list))),
286 icl::Nirwana::instance());
287 BOOST_CHECK(read_successful);
289 BOOST_CHECK_EQUAL(config_list.size(), 3u);
291 BOOST_CHECK_EQUAL(config_list[0].
string_value,
"string-value-1");
298 BOOST_CHECK_EQUAL(config_list[1].string_value,
"string-value-2");
301 BOOST_CHECK_EQUAL(config_list[1].enum_value,
TWO);
305 BOOST_CHECK_EQUAL(config_list[2].string_value,
"string-value-3");
308 BOOST_CHECK_EQUAL(config_list[2].enum_value,
THREE);
314 # if defined(_MSC_VER) 315 # pragma message("The icl_core_config batch convenience macros are only available in Visual Studio 2010 and newer.") 319 BOOST_AUTO_TEST_SUITE_END()
#define CONFIG_ENUM(key, value, descriptions)
#define MEMBER_MAPPING(cls, arg)
bool get(const icl_core::String &key, typename icl_core::ConvertToRef< T >::ToRef value)
Gets the value for the specified key from the configuration.
char const * enum_value_char_description[]
#define CONFIG_VALUES(list)
#define MEMBER_ENUM_1(suffix, cls, member1, descriptions)
#define MEMBER_ENUM_2(suffix, cls, member1, member2, descriptions)
Base header file for the configuration framework.
#define CONFIG_LIST(cls, prefix, members, result)
BOOST_AUTO_TEST_CASE(TestStaticParser)
#define MEMBER_VALUE_3(suffix, cls, member1, member2, member3)
void setValue(const icl_core::String &key, typename icl_core::ConvertToRef< T >::ToConstRef value)
#define CONFIG_VALUE(key, value)
#define MEMBER_VALUE_1(suffix, cls, member1)
std::vector< std::string > enum_value_description
struct ConfigListEntry::Foo foo
Framework for processing configuration files.
#define MEMBER_VALUE_2(suffix, cls, member1, member2)
#define CONFIG_VALUE_DEFAULT(key, value, default_value)
#define CONFIG_ENUM_DEFAULT(key, value, default_value, descriptions)
struct ConfigListEntry::Foo::Bar bar
Flexible, powerful, configurable logging framework.
#define MEMBER_ENUM_3(suffix, cls, member1, member2, member3, descriptions)