Skip to content

Commit

Permalink
extend attibute_value unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf committed Jun 27, 2014
1 parent 606becd commit 5089669
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/tests/test_config.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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()

0 comments on commit 5089669

Please sign in to comment.