From 5089669eb95c8a0fd31f8fbe4dff584885c259b4 Mon Sep 17 00:00:00 2001 From: gfgtdf Date: Fri, 27 Jun 2014 21:05:43 +0200 Subject: [PATCH] extend attibute_value unit test --- src/tests/test_config.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/tests/test_config.cpp b/src/tests/test_config.cpp index 15c9af08e6ca..db6fdef76632 100644 --- a/src/tests/test_config.cpp +++ b/src/tests/test_config.cpp @@ -24,6 +24,7 @@ BOOST_AUTO_TEST_SUITE ( test_config ) BOOST_AUTO_TEST_CASE ( test_config_attribute_value ) { config c; + const config& cc = c; int x_int; std::string x_str; long long x_sll; @@ -146,6 +147,29 @@ BOOST_AUTO_TEST_CASE ( test_config_attribute_value ) BOOST_CHECK_EQUAL(x_sll, 123456789123ll); x_str = c["x"].str(); BOOST_CHECK_EQUAL(x_str, "123456789123"); + + // blank != "" test. + c = config(); + BOOST_CHECK(cc["x"] != ""); + BOOST_CHECK(cc["x"].empty()); + BOOST_CHECK(cc["x"].blank()); + + BOOST_CHECK(c["x"] != ""); + BOOST_CHECK(c["x"].empty()); + BOOST_CHECK(c["x"].blank()); + + BOOST_CHECK_EQUAL(cc["x"], c["x"]); + + c["x"] = ""; + BOOST_CHECK(cc["x"] == ""); + BOOST_CHECK(cc["x"].empty()); + BOOST_CHECK(!cc["x"].blank()); + + BOOST_CHECK(c["x"] == ""); + BOOST_CHECK(c["x"].empty()); + BOOST_CHECK(!c["x"].blank()); + + BOOST_CHECK_EQUAL(cc["x"], c["x"]); } BOOST_AUTO_TEST_SUITE_END()