// // Copyright (c) 2008 João Abecasis // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // // This file and the homonymous .ini file constitute an interface and // functionality test for the ini processing facilities available to adaptor // developers. // #include #include #include int main(int /*argc*/, char const ** argv) { saga::ini::section conf(argv[0] + std::string(".ini")); // Identifying sections and nested sections. BOOST_ASSERT(conf.has_section("section")); // FIXME: has_section_full should be folded into has_section. BOOST_ASSERT(conf.has_section_full("section.nested")); BOOST_ASSERT(conf.has_section_full("section.nested.even.more")); { // Getting and reading from a section // FIXME: These should also work, for consistency with get_entry. // BOOST_ASSERT(conf.has_entry("section.entry")); // BOOST_ASSERT(!conf.has_entry("section.no-entry")); saga::ini::section section = conf.get_section("section"); BOOST_ASSERT(section.has_entry("entry")); BOOST_ASSERT(!section.has_entry("no-entry")); } // Getting nested entries BOOST_ASSERT("value" == conf.get_entry("section.entry")); BOOST_ASSERT("default" == conf.get_entry("section.no-entry", "default")); { // Accessing a nested section saga::ini::section very_nested_section = conf.get_section("section.nested.even.more"); BOOST_ASSERT("very-nested-value" == very_nested_section.get_entry("very-nested-entry")); } }