Fix setting enums that are typedefs

Issue: https://tree.taiga.io/project/jktjkt-netconf-cli/issue/64
Change-Id: Ibbeb8f6d89cfd0c104126d1bc3d7fbffc3aa3771
diff --git a/tests/yang.cpp b/tests/yang.cpp
index 6f63bfc..dc2286d 100644
--- a/tests/yang.cpp
+++ b/tests/yang.cpp
@@ -11,6 +11,7 @@
 
 const char* schema = R"(
 module example-schema {
+    yang-version 1.1;
     namespace "http://example.com/example-sports";
     prefix coze;
 
@@ -64,6 +65,36 @@
         }
     }
 
+    typedef enumTypedef {
+        type enumeration {
+            enum lol;
+            enum data;
+            enum coze;
+        }
+    }
+
+    typedef enumTypedefRestricted {
+        type enumTypedef {
+            enum lol;
+            enum data;
+        }
+    }
+
+    leaf leafEnumTypedef {
+        type enumTypedef;
+    }
+
+    leaf leafEnumTypedefRestricted {
+        type enumTypedef {
+            enum data;
+            enum coze;
+        }
+    }
+
+    leaf leafEnumTypedefRestricted2 {
+        type enumTypedefRestricted;
+    }
+
     list _list {
         key number;
 
@@ -164,18 +195,60 @@
         }
         SECTION("leafEnumHasValue")
         {
-            node.first = "example-schema";
-            node.second = "leafEnum";
             std::string value;
+            SECTION("leafEnum")
+            {
+                node.first = "example-schema";
+                node.second = "leafEnum";
 
-            SECTION("lol")
-            value = "lol";
+                SECTION("lol")
+                    value = "lol";
 
-            SECTION("data")
-            value = "data";
+                SECTION("data")
+                    value = "data";
 
-            SECTION("coze")
-            value = "coze";
+                SECTION("coze")
+                    value = "coze";
+            }
+
+            SECTION("leafEnumTypedef")
+            {
+                node.first = "example-schema";
+                node.second = "leafEnumTypedef";
+
+                SECTION("lol")
+                    value = "lol";
+
+                SECTION("data")
+                    value = "data";
+
+                SECTION("coze")
+                    value = "coze";
+            }
+
+            SECTION("leafEnumTypedefRestricted")
+            {
+                node.first = "example-schema";
+                node.second = "leafEnumTypedefRestricted";
+
+                SECTION("data")
+                    value = "data";
+
+                SECTION("coze")
+                    value = "coze";
+            }
+
+            SECTION("leafEnumTypedefRestricted2")
+            {
+                node.first = "example-schema";
+                node.second = "leafEnumTypedefRestricted2";
+
+                SECTION("lol")
+                    value = "lol";
+
+                SECTION("data")
+                    value = "data";
+            }
 
             REQUIRE(ys.leafEnumHasValue(path, node, value));
         }
@@ -279,7 +352,9 @@
             {
                 set = {"example-schema:a", "example-schema:b", "example-schema:leafString",
                        "example-schema:leafDecimal", "example-schema:leafBool", "example-schema:leafInt",
-                       "example-schema:leafUint", "example-schema:leafEnum", "example-schema:_list", "example-schema:twoKeyList"};
+                       "example-schema:leafUint", "example-schema:leafEnum", "example-schema:leafEnumTypedef",
+                       "example-schema:leafEnumTypedefRestricted", "example-schema:leafEnumTypedefRestricted2",
+                       "example-schema:_list", "example-schema:twoKeyList"};
             }
 
             SECTION("a")