@@ -88,6 +88,19 @@ const char *schema_a =
88
88
" type string;\n"
89
89
" }\n"
90
90
" }\n"
91
+ "\n"
92
+ " rpc r {\n"
93
+ " input {\n"
94
+ " leaf l {\n"
95
+ " type string;\n"
96
+ " }\n"
97
+ " }\n"
98
+ " output {\n"
99
+ " leaf l {\n"
100
+ " type string;\n"
101
+ " }\n"
102
+ " }\n"
103
+ " }\n"
91
104
"}" ;
92
105
93
106
static int
@@ -382,6 +395,31 @@ test_hash(void **state)
382
395
lyd_free_all (tree );
383
396
}
384
397
398
+ static void
399
+ test_rpc (void * * state )
400
+ {
401
+ const char * data =
402
+ "<r xmlns=\"urn:tests:a\">\n"
403
+ " <l>val</l>\n"
404
+ "</r>" ;
405
+ struct ly_in * in ;
406
+ struct lyd_node * tree ;
407
+ struct ly_set * set ;
408
+
409
+ assert_int_equal (LY_SUCCESS , ly_in_new_memory (data , & in ));
410
+ assert_int_equal (LY_SUCCESS , lyd_parse_op (UTEST_LYCTX , NULL , in , LYD_XML , LYD_TYPE_REPLY_YANG , & tree , NULL ));
411
+ ly_in_free (in , 0 );
412
+ assert_non_null (tree );
413
+
414
+ /* name collision input/output, hashes are not used */
415
+ assert_int_equal (LY_SUCCESS , lyd_find_xpath (tree , "/a:r/l" , & set ));
416
+ assert_int_equal (1 , set -> count );
417
+
418
+ ly_set_free (set , NULL );
419
+
420
+ lyd_free_all (tree );
421
+ }
422
+
385
423
static void
386
424
test_toplevel (void * * state )
387
425
{
@@ -481,7 +519,7 @@ test_atomize(void **state)
481
519
482
520
/* some random paths just making sure the API function works */
483
521
assert_int_equal (LY_SUCCESS , lys_find_xpath_atoms (UTEST_LYCTX , NULL , "/a:*" , 0 , & set ));
484
- assert_int_equal (6 , set -> count );
522
+ assert_int_equal (7 , set -> count );
485
523
ly_set_free (set , NULL );
486
524
487
525
/* all nodes from all modules (including internal, which can change easily, so check just the test modules) */
@@ -498,7 +536,7 @@ test_atomize(void **state)
498
536
ly_set_free (set , NULL );
499
537
500
538
assert_int_equal (LY_SUCCESS , lys_find_xpath_atoms (UTEST_LYCTX , NULL , "/*" , 0 , & set ));
501
- assert_int_equal (13 , set -> count );
539
+ assert_int_equal (14 , set -> count );
502
540
ly_set_free (set , NULL );
503
541
504
542
/*
@@ -532,7 +570,7 @@ test_atomize(void **state)
532
570
533
571
/* descendant-or-self */
534
572
assert_int_equal (LY_SUCCESS , lys_find_xpath_atoms (UTEST_LYCTX , NULL , "/a:*/descendant-or-self::c" , 0 , & set ));
535
- assert_int_equal (7 , set -> count );
573
+ assert_int_equal (8 , set -> count );
536
574
ly_set_free (set , NULL );
537
575
538
576
/* following */
@@ -547,11 +585,11 @@ test_atomize(void **state)
547
585
548
586
/* parent */
549
587
assert_int_equal (LY_SUCCESS , lys_find_xpath_atoms (UTEST_LYCTX , NULL , "/child::a:*/c/parent::l1" , 0 , & set ));
550
- assert_int_equal (7 , set -> count );
588
+ assert_int_equal (8 , set -> count );
551
589
ly_set_free (set , NULL );
552
590
553
591
assert_int_equal (LY_SUCCESS , lys_find_xpath_atoms (UTEST_LYCTX , NULL , "/child::a:c//.." , 0 , & set ));
554
- assert_int_equal (8 , set -> count );
592
+ assert_int_equal (11 , set -> count );
555
593
ly_set_free (set , NULL );
556
594
557
595
/* preceding */
@@ -1062,6 +1100,7 @@ main(void)
1062
1100
UTEST (test_union , setup ),
1063
1101
UTEST (test_invalid , setup ),
1064
1102
UTEST (test_hash , setup ),
1103
+ UTEST (test_rpc , setup ),
1065
1104
UTEST (test_toplevel , setup ),
1066
1105
UTEST (test_atomize , setup ),
1067
1106
UTEST (test_canonize , setup ),
0 commit comments