YANG: Junit testcases for restricions resolution
Change-Id: I35b8a579f924af50a5e2192bdac36dc94784198e
diff --git a/utils/yangutils/src/test/resources/LengthRestrictionInRefType.yang b/utils/yangutils/src/test/resources/LengthRestrictionInRefType.yang
new file mode 100644
index 0000000..54684f4
--- /dev/null
+++ b/utils/yangutils/src/test/resources/LengthRestrictionInRefType.yang
@@ -0,0 +1,13 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello {
+ length "0..100";
+ }
+ }
+ typedef hello {
+ type string;
+ }
+}
diff --git a/utils/yangutils/src/test/resources/LengthRestrictionInTypedef.yang b/utils/yangutils/src/test/resources/LengthRestrictionInTypedef.yang
new file mode 100644
index 0000000..17baeec
--- /dev/null
+++ b/utils/yangutils/src/test/resources/LengthRestrictionInTypedef.yang
@@ -0,0 +1,13 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello;
+ }
+ typedef hello {
+ type string {
+ length "0..100";
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/LengthRestrictionInTypedefAndTypeInValid.yang b/utils/yangutils/src/test/resources/LengthRestrictionInTypedefAndTypeInValid.yang
new file mode 100644
index 0000000..65ed7de
--- /dev/null
+++ b/utils/yangutils/src/test/resources/LengthRestrictionInTypedefAndTypeInValid.yang
@@ -0,0 +1,15 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello {
+ length "min..20 | 200..max";
+ }
+ }
+ typedef hello {
+ type string {
+ length "0..100 | 101..200 | 201..300";
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/LengthRestrictionInTypedefAndTypeValid.yang b/utils/yangutils/src/test/resources/LengthRestrictionInTypedefAndTypeValid.yang
new file mode 100644
index 0000000..eca2691
--- /dev/null
+++ b/utils/yangutils/src/test/resources/LengthRestrictionInTypedefAndTypeValid.yang
@@ -0,0 +1,15 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello {
+ length "min..20 | 201..max";
+ }
+ }
+ typedef hello {
+ type string {
+ length "0..100 | 101..200 | 201..300";
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/MultiplePatternAndLengthRestriction.yang b/utils/yangutils/src/test/resources/MultiplePatternAndLengthRestriction.yang
new file mode 100644
index 0000000..d971643
--- /dev/null
+++ b/utils/yangutils/src/test/resources/MultiplePatternAndLengthRestriction.yang
@@ -0,0 +1,19 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello {
+ pattern "[a-z]";
+ pattern "[A-Z]";
+ length "min..20 | 201..max";
+ }
+ }
+ typedef hello {
+ type string {
+ pattern "[0-9]";
+ pattern "[\n]";
+ length "0..100 | 101..200 | 201..300";
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/MultiplePatternAndLengthRestrictionInValid.yang b/utils/yangutils/src/test/resources/MultiplePatternAndLengthRestrictionInValid.yang
new file mode 100644
index 0000000..7ba3ef9
--- /dev/null
+++ b/utils/yangutils/src/test/resources/MultiplePatternAndLengthRestrictionInValid.yang
@@ -0,0 +1,19 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello {
+ pattern "[a-z]";
+ pattern "[A-Z]";
+ length "min..20 | 100..max";
+ }
+ }
+ typedef hello {
+ type string {
+ pattern "[0-9]";
+ pattern "[\n]";
+ length "0..100 | 101..200 | 201..300";
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/MultiplePatternAndLengthRestrictionValid.yang b/utils/yangutils/src/test/resources/MultiplePatternAndLengthRestrictionValid.yang
new file mode 100644
index 0000000..161b558
--- /dev/null
+++ b/utils/yangutils/src/test/resources/MultiplePatternAndLengthRestrictionValid.yang
@@ -0,0 +1,18 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello {
+ pattern "[a-z]";
+ pattern "[A-Z]";
+ length "min..20 | 100..max";
+ }
+ }
+ typedef hello {
+ type string {
+ pattern "[0-9]";
+ pattern "[\n]";
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/MultiplePatternRestrictionInRefTypeAndTypedef.yang b/utils/yangutils/src/test/resources/MultiplePatternRestrictionInRefTypeAndTypedef.yang
new file mode 100644
index 0000000..eaa28c5
--- /dev/null
+++ b/utils/yangutils/src/test/resources/MultiplePatternRestrictionInRefTypeAndTypedef.yang
@@ -0,0 +1,17 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello {
+ pattern "[a-z]";
+ pattern "[A-Z]";
+ }
+ }
+ typedef hello {
+ type string {
+ pattern "[0-9]";
+ pattern "[\n]";
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/PatternRestrictionInRefType.yang b/utils/yangutils/src/test/resources/PatternRestrictionInRefType.yang
new file mode 100644
index 0000000..189177d
--- /dev/null
+++ b/utils/yangutils/src/test/resources/PatternRestrictionInRefType.yang
@@ -0,0 +1,13 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello {
+ pattern "[a-zA-Z]";
+ }
+ }
+ typedef hello {
+ type string;
+ }
+}
diff --git a/utils/yangutils/src/test/resources/PatternRestrictionInRefTypeAndTypedef.yang b/utils/yangutils/src/test/resources/PatternRestrictionInRefTypeAndTypedef.yang
new file mode 100644
index 0000000..e01b224
--- /dev/null
+++ b/utils/yangutils/src/test/resources/PatternRestrictionInRefTypeAndTypedef.yang
@@ -0,0 +1,15 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello {
+ pattern "[a-zA-Z]";
+ }
+ }
+ typedef hello {
+ type string {
+ pattern "[0-9]";
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/PatternRestrictionInTypedef.yang b/utils/yangutils/src/test/resources/PatternRestrictionInTypedef.yang
new file mode 100644
index 0000000..7875504
--- /dev/null
+++ b/utils/yangutils/src/test/resources/PatternRestrictionInTypedef.yang
@@ -0,0 +1,13 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello;
+ }
+ typedef hello {
+ type string {
+ pattern "[a-zA-Z]";
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/RangeRestrictionInRefType.yang b/utils/yangutils/src/test/resources/RangeRestrictionInRefType.yang
new file mode 100644
index 0000000..da396fa
--- /dev/null
+++ b/utils/yangutils/src/test/resources/RangeRestrictionInRefType.yang
@@ -0,0 +1,13 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello {
+ range "1..4 | 10..20";
+ }
+ }
+ typedef hello {
+ type int32;
+ }
+}
diff --git a/utils/yangutils/src/test/resources/RangeRestrictionInRefTypeAndTypedefInValid.yang b/utils/yangutils/src/test/resources/RangeRestrictionInRefTypeAndTypedefInValid.yang
new file mode 100644
index 0000000..f45f1ee
--- /dev/null
+++ b/utils/yangutils/src/test/resources/RangeRestrictionInRefTypeAndTypedefInValid.yang
@@ -0,0 +1,15 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello {
+ range "min..4 | min..max";
+ }
+ }
+ typedef hello {
+ type int32 {
+ range "1..4 | 10..20";
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/RangeRestrictionInRefTypeAndTypedefValid.yang b/utils/yangutils/src/test/resources/RangeRestrictionInRefTypeAndTypedefValid.yang
new file mode 100644
index 0000000..b0af767
--- /dev/null
+++ b/utils/yangutils/src/test/resources/RangeRestrictionInRefTypeAndTypedefValid.yang
@@ -0,0 +1,15 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello {
+ range "min..4 | 10..max";
+ }
+ }
+ typedef hello {
+ type int32 {
+ range "1..4 | 10..20";
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/RangeRestrictionInString.yang b/utils/yangutils/src/test/resources/RangeRestrictionInString.yang
new file mode 100644
index 0000000..f167230
--- /dev/null
+++ b/utils/yangutils/src/test/resources/RangeRestrictionInString.yang
@@ -0,0 +1,13 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello;
+ }
+ typedef hello {
+ type string {
+ range "1..4 | 10..20";
+ }
+ }
+}
diff --git a/utils/yangutils/src/test/resources/RangeRestrictionInStringInRefType.yang b/utils/yangutils/src/test/resources/RangeRestrictionInStringInRefType.yang
new file mode 100644
index 0000000..c08635f
--- /dev/null
+++ b/utils/yangutils/src/test/resources/RangeRestrictionInStringInRefType.yang
@@ -0,0 +1,13 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello {
+ range "1..4 | 10..20";
+ }
+ }
+ typedef hello {
+ type string;
+ }
+}
diff --git a/utils/yangutils/src/test/resources/RangeRestrictionInTypedef.yang b/utils/yangutils/src/test/resources/RangeRestrictionInTypedef.yang
new file mode 100644
index 0000000..0f53d1f
--- /dev/null
+++ b/utils/yangutils/src/test/resources/RangeRestrictionInTypedef.yang
@@ -0,0 +1,13 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello;
+ }
+ typedef hello {
+ type int32 {
+ range "1..4 | 10..20";
+ }
+ }
+}