Add parser support for bits
Change-Id: I8f36a2639d3f4911c2fb825dd3bf28956886a9a6
diff --git a/tests/yang.cpp b/tests/yang.cpp
index f226778..93e5925 100644
--- a/tests/yang.cpp
+++ b/tests/yang.cpp
@@ -429,6 +429,14 @@
leaf-list addresses {
type string;
}
+
+ leaf flagBits {
+ type bits {
+ bit carry;
+ bit sign;
+ bit overflow;
+ }
+ }
})";
TEST_CASE("yangschema")
@@ -720,6 +728,13 @@
type.emplace<yang::String>();
}
+ SECTION("flagBits")
+ {
+ node.first = "example-schema";
+ node.second = "flagBits";
+ type = yang::Bits{{"carry", "sign", "overflow"}};
+ }
+
REQUIRE(ys.leafType(path, node) == type);
}
@@ -764,7 +779,8 @@
{"example-schema"s, "systemStats"},
{"example-schema"s, "dummyLeaf"},
{"example-schema"s, "addresses"},
- {"example-schema"s, "subLeaf"}};
+ {"example-schema"s, "subLeaf"},
+ {"example-schema"s, "flagBits"}};
}
SECTION("example-schema:a")
@@ -819,6 +835,7 @@
{"example-schema"s, "ethernet"},
{"example-schema"s, "foodDrinkIdentLeaf"},
{"example-schema"s, "foodIdentLeaf"},
+ {"example-schema"s, "flagBits"},
{"example-schema"s, "interrupt"},
{"example-schema"s, "leafBool"},
{"example-schema"s, "leafDecimal"},
@@ -875,6 +892,8 @@
{boost::none, "/example-schema:direction"},
{boost::none, "/example-schema:duration"},
{boost::none, "/example-schema:dummyLeaf"},
+ {boost::none, "/example-schema:flagBits"},
+ {boost::none, "/example-schema:foodDrinkIdentLeaf"},
{boost::none, "/example-schema:foodDrinkIdentLeaf"},
{boost::none, "/example-schema:foodIdentLeaf"},
{boost::none, "/example-schema:interface/caseEthernet/ethernet"},