Commit 849439da authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[4259] Add unit tests to ensure StringParser can parse booleans

    Added checks to ensure that StringParser can handle being given
    a boolean literal (i.e. unquoted true or false)
parent 12320a72
......@@ -144,6 +144,24 @@ TEST_F(DhcpParserTest, stringParserTest) {
parser.commit();
EXPECT_NO_THROW((actual_value = storage->getParam(name)));
EXPECT_EQ(test_value, actual_value);
// Verify that parser with accepts a boolean true element.
element = Element::create(true);
EXPECT_NO_THROW(parser.build(element));
// Verify that commit updates storage.
parser.commit();
EXPECT_NO_THROW((actual_value = storage->getParam(name)));
EXPECT_EQ("true", actual_value);
// Verify that parser with accepts a boolean true element.
element = Element::create(false);
EXPECT_NO_THROW(parser.build(element));
// Verify that commit updates storage.
parser.commit();
EXPECT_NO_THROW((actual_value = storage->getParam(name)));
EXPECT_EQ("false", actual_value);
}
/// @brief Check Uint32Parser basic functionality
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment