diff --git a/tests/utests/data/test_diff.c b/tests/utests/data/test_diff.c index d85027b50..ea87bf4a0 100644 --- a/tests/utests/data/test_diff.c +++ b/tests/utests/data/test_diff.c @@ -59,248 +59,99 @@ lyd_free_all(diff2);\ } -const char *schema1 = - "module defaults {\n" - " yang-version 1.1;\n" - " namespace \"urn:libyang:tests:defaults\";\n" - " prefix df;\n" +const char *schema = + "module defaults {" + "yang-version 1.1;" + "namespace \"urn:libyang:tests:defaults\";" + "prefix df;" "" - " feature unhide;\n" + "feature unhide;" "" - " typedef defint32 {\n" - " type int32;\n" - " default \"42\";\n" - " }\n" + "typedef defint32 {type int32; default \"42\";}" "" - " leaf hiddenleaf {\n" - " if-feature \"unhide\";\n" - " type int32;\n" - " default \"42\";\n" - " }\n" - "" - " container df {\n" - " leaf foo {\n" - " type defint32;\n" - " }\n" - "" - " leaf hiddenleaf {\n" - " if-feature \"unhide\";\n" - " type int32;\n" - " default \"42\";\n" - " }\n" - "" - " container bar {\n" - " presence \"\";\n" - " leaf hi {\n" - " type int32;\n" - " default \"42\";\n" - " }\n" - "" - " leaf ho {\n" - " type int32;\n" - " mandatory true;\n" - " }\n" - " }\n" - "" - " leaf-list llist {\n" - " type defint32;\n" - " ordered-by user;\n" - " }\n" - "" - " list ul {\n" - " key \"l1\";\n" - " ordered-by user;\n" - " leaf l1 {\n" - " type string;\n" - " }\n" - "" - " leaf l2 {\n" - " type int32;\n" - " }\n" - "" - " container cont {\n" - " leaf l3 {\n" - " type string;\n" - " }\n" - " }\n" - " }\n" - "" - " leaf-list dllist {\n" - " type uint8;\n" - " default \"1\";\n" - " default \"2\";\n" - " default \"3\";\n" - " }\n" - "" - " list list {\n" - " key \"name\";\n" - " leaf name {\n" - " type string;\n" - " }\n" - "" - " leaf value {\n" - " type int32;\n" - " default \"42\";\n" - " }\n" - " list list2 {\n" - " key \"name2\";\n" - " leaf name2 {\n" - " type string;\n" - " }\n" - " leaf value2 {\n" - " type int32;\n" - " }\n" - " }\n" - " }\n"; -const char *schema2 = - " choice select {\n" - " default \"a\";\n" - " case a {\n" - " choice a {\n" - " leaf a1 {\n" - " type int32;\n" - " default \"42\";\n" - " }\n" - "" - " leaf a2 {\n" - " type int32;\n" - " default \"24\";\n" - " }\n" - " }\n" - " }\n" - "" - " leaf b {\n" - " type string;\n" - " }\n" - "" - " container c {\n" - " presence \"\";\n" - " leaf x {\n" - " type int32;\n" - " default \"42\";\n" - " }\n" - " }\n" - " }\n" - "" - " choice select2 {\n" - " default \"s2b\";\n" - " leaf s2a {\n" - " type int32;\n" - " default \"42\";\n" - " }\n" - "" - " case s2b {\n" - " choice s2b {\n" - " default \"b1\";\n" - " case b1 {\n" - " leaf b1_1 {\n" - " type int32;\n" - " default \"42\";\n" - " }\n" - "" - " leaf b1_2 {\n" - " type string;\n" - " }\n" - "" - " leaf b1_status {\n" - " type int32;\n" - " default \"42\";\n" - " config false;\n" - " }\n" - " }\n" - "" - " leaf b2 {\n" - " type int32;\n" - " default \"42\";\n" - " }\n" - " }\n" - " }\n" - " }\n" - " list kl {\n" - " config \"false\";\n" - " leaf l1 {\n" - " type string;\n" - " }\n" - "" - " leaf l2 {\n" - " type int32;\n" - " }\n" - " }\n" - "" - " leaf-list kll {\n" - " config \"false\";\n" - " type string;\n" - " }\n" - " }\n" - "" - " container hidden {\n" - " leaf foo {\n" - " type int32;\n" - " default \"42\";\n" - " }\n" - "" - " leaf baz {\n" - " type int32;\n" - " default \"42\";\n" - " }\n" - "" - " leaf papa {\n" - " type int32;\n" - " default \"42\";\n" - " config false;\n" - " }\n" - " }\n" - "" - " rpc rpc1 {\n" - " input {\n" - " leaf inleaf1 {\n" - " type string;\n" - " }\n" - "" - " leaf inleaf2 {\n" - " type string;\n" - " default \"def1\";\n" - " }\n" - " }\n" - "" - " output {\n" - " leaf outleaf1 {\n" - " type string;\n" - " default \"def2\";\n" - " }\n" - "" - " leaf outleaf2 {\n" - " type string;\n" - " }\n" - " }\n" - " }\n" - "" - " notification notif {\n" - " leaf ntfleaf1 {\n" - " type string;\n" - " default \"def3\";\n" - " }\n" - "" - " leaf ntfleaf2 {\n" - " type string;\n" - " }\n" - " }\n" - "}\n"; + "leaf hiddenleaf {if-feature \"unhide\"; type int32; default \"42\";}" + "container df {" + " leaf foo {type defint32; }" + " leaf hiddenleaf {if-feature \"unhide\"; type int32; default \"42\";}" + " container bar { presence \"\";" + " leaf hi {type int32; default \"42\";}" + " leaf ho {type int32; mandatory true;}" + " }" + " leaf-list llist {type defint32; ordered-by user;}" + " list ul {key \"l1\"; ordered-by user;" + " leaf l1 {type string;}" + " leaf l2 {type int32;}" + " container cont {" + " leaf l3 {type string;}" + " }" + " }" + " leaf-list dllist {type uint8; default \"1\"; default \"2\"; default \"3\";}" + " list list {key \"name\";" + " leaf name {type string;}" + " leaf value {type int32; default \"42\";}" + " list list2 {key \"name2\";" + " leaf name2 {type string;}" + " leaf value2 {type int32;}" + " }" + " }" + " choice select {default \"a\";" + " case a {" + " choice a {" + " leaf a1 {type int32; default \"42\";}" + " leaf a2 {type int32; default \"24\";}" + " }" + " }" + " leaf b {type string;}" + " container c {presence \"\";" + " leaf x {type int32; default \"42\";}" + " }" + " }" + " choice select2 {default \"s2b\";" + " leaf s2a {type int32; default \"42\";}" + " case s2b {" + " choice s2b {default \"b1\";" + " case b1 {" + " leaf b1_1 {type int32; default \"42\";}" + " leaf b1_2 {type string;}" + " leaf b1_status {type int32; default \"42\"; config false;}" + " }" + " leaf b2 {type int32; default \"42\";}" + " }" + " }" + " }" + " list kl {config \"false\";" + " leaf l1 {type string;}" + " leaf l2 {type int32;}" + " }" + " leaf-list kll {config \"false\"; type string;}" + "}" + "container hidden {" + " leaf foo {type int32; default \"42\";}" + " leaf baz {type int32; default \"42\";}" + " leaf papa {type int32; default \"42\"; config false;}" + "}" + "rpc rpc1 {" + " input {" + " leaf inleaf1 {type string;}" + " leaf inleaf2 {type string; default \"def1\";}" + " }" + " output {" + " leaf outleaf1 {type string; default \"def2\";}" + " leaf outleaf2 {type string;}" + " }" + "}" + "notification notif {" + " leaf ntfleaf1 {type string; default \"def3\";}" + " leaf ntfleaf2 {type string;}" + "}" + "}"; static int setup(void **state) { - char *schema; - UTEST_SETUP; - /* create one schema, longer than 4095 chars */ - schema = malloc(strlen(schema1) + strlen(schema2) + 1); - strcpy(schema, schema1); - strcat(schema, schema2); - UTEST_ADD_MODULE(schema, LYS_IN_YANG, NULL, NULL); - free(schema); return 0; }