@@ -43,7 +43,7 @@ char *yin_modules[2 * MOD_COUNT] = {0};
4343static int
4444setup_ctx_yin (void * * state )
4545{
46- * state = malloc (strlen (TESTS_DIR ) + 40 );
46+ * state = malloc (strlen (TESTS_DIR ) + 64 );
4747 assert_non_null (* state );
4848 memcpy (* state , SCHEMA_FOLDER_YIN , strlen (SCHEMA_FOLDER_YIN ) + 1 );
4949
@@ -58,7 +58,7 @@ setup_ctx_yin(void **state)
5858static int
5959setup_ctx_yang (void * * state )
6060{
61- * state = malloc (strlen (TESTS_DIR ) + 40 );
61+ * state = malloc (strlen (TESTS_DIR ) + 64 );
6262 assert_non_null (* state );
6363 memcpy (* state , SCHEMA_FOLDER_YANG , strlen (SCHEMA_FOLDER_YANG ) + 1 );
6464
@@ -154,11 +154,17 @@ test_leafref_w_feature1(void **state)
154154
155155 ly_ctx_set_searchdir (ctx , path );
156156 length = strlen (path );
157- strcpy (path + length , "/leafref_w_feature1-mod3.yang" );
158- if (!(module = lys_parse_path (ctx , path , LYS_IN_YANG ))) {
159- fail ();
157+ if (!strcmp (path , SCHEMA_FOLDER_YIN )) {
158+ strcpy (path + length , "/leafref_w_feature1-mod3.yin" );
159+ if (!(module = lys_parse_path (ctx , path , LYS_IN_YIN ))) {
160+ fail ();
161+ }
162+ } else {
163+ strcpy (path + length , "/leafref_w_feature1-mod3.yang" );
164+ if (!(module = lys_parse_path (ctx , path , LYS_IN_YANG ))) {
165+ fail ();
166+ }
160167 }
161- lys_print_mem (& yang_modules [YANG_MOD_IDX (0 )], module , LYS_OUT_YANG , NULL );
162168}
163169
164170static void
@@ -170,11 +176,17 @@ test_leafref_w_feature2(void **state)
170176
171177 ly_ctx_set_searchdir (ctx , path );
172178 length = strlen (path );
173- strcpy (path + length , "/leafref_w_feature2-mod1.yang" );
174- if (!(module = lys_parse_path (ctx , path , LYS_IN_YANG ))) {
175- fail ();
179+ if (!strcmp (path , SCHEMA_FOLDER_YIN )) {
180+ strcpy (path + length , "/leafref_w_feature2-mod1.yin" );
181+ if (!(module = lys_parse_path (ctx , path , LYS_IN_YIN ))) {
182+ fail ();
183+ }
184+ } else {
185+ strcpy (path + length , "/leafref_w_feature2-mod1.yang" );
186+ if (!(module = lys_parse_path (ctx , path , LYS_IN_YANG ))) {
187+ fail ();
188+ }
176189 }
177- lys_print_mem (& yang_modules [YANG_MOD_IDX (0 )], module , LYS_OUT_YANG , NULL );
178190}
179191
180192static void
@@ -323,15 +335,17 @@ main(void)
323335 cmocka_unit_test_setup_teardown (test_target_include_submodule , setup_ctx_yin , teardown_ctx ),
324336 cmocka_unit_test_setup_teardown (test_leafref , setup_ctx_yin , teardown_ctx ),
325337 cmocka_unit_test_setup_teardown (test_target_augment , setup_ctx_yin , teardown_ctx ),
326- cmocka_unit_test_setup_teardown (test_leafref_w_feature1 , setup_ctx_yang , teardown_ctx ),
327- cmocka_unit_test_setup_teardown (test_leafref_w_feature2 , setup_ctx_yang , teardown_ctx ),
328338 cmocka_unit_test_setup_teardown (test_unres_augment , setup_ctx_yin , teardown_ctx ),
329339 cmocka_unit_test_setup_teardown (test_import_augment_target , setup_ctx_yin , teardown_ctx ),
340+ cmocka_unit_test_setup_teardown (test_leafref_w_feature1 , setup_ctx_yin , teardown_ctx ),
341+ cmocka_unit_test_setup_teardown (test_leafref_w_feature2 , setup_ctx_yin , teardown_ctx ),
330342 cmocka_unit_test_setup_teardown (test_target_include_submodule , setup_ctx_yang , teardown_ctx ),
331343 cmocka_unit_test_setup_teardown (test_leafref , setup_ctx_yang , teardown_ctx ),
332344 cmocka_unit_test_setup_teardown (test_target_augment , setup_ctx_yang , teardown_ctx ),
333345 cmocka_unit_test_setup_teardown (test_unres_augment , setup_ctx_yang , teardown_ctx ),
334346 cmocka_unit_test_setup_teardown (test_import_augment_target , setup_ctx_yang , teardown_ctx ),
347+ cmocka_unit_test_setup_teardown (test_leafref_w_feature1 , setup_ctx_yang , teardown_ctx ),
348+ cmocka_unit_test_setup_teardown (test_leafref_w_feature2 , setup_ctx_yang , teardown_ctx ),
335349 cmocka_unit_test_teardown (compare_output , teardown_output ),
336350 };
337351
0 commit comments