|
| 1 | +create or replace procedure check_annotation_parsing(a_expected ut_annotations.typ_annotated_package, a_parsing_result ut_annotations.typ_annotated_package) is |
| 2 | + procedure check_annotation_params(a_msg varchar2, a_expected ut_annotations.tt_annotation_params, a_actual ut_annotations.tt_annotation_params) is |
| 3 | + begin |
| 4 | + ut_assert.are_equal('['||a_msg||']Check number of annotation params', a_expected.count, a_actual.count); |
| 5 | + |
| 6 | + if a_expected.count = a_actual.count and a_expected.count > 0 then |
| 7 | + for i in 1..a_expected.count loop |
| 8 | + if a_expected(i).key is not null then |
| 9 | + ut_assert.are_equal('['||a_msg||'('||i||')]Check annotation param key',a_expected(i).key,a_actual(i).key); |
| 10 | + else |
| 11 | + ut_assert.is_null('['||a_msg||'('||i||')]Check annotation param key',a_actual(i).key); |
| 12 | + end if; |
| 13 | + |
| 14 | + if a_expected(i).value is not null then |
| 15 | + ut_assert.are_equal('['||a_msg||'('||i||')]Check annotation param value',a_expected(i).value,a_actual(i).value); |
| 16 | + else |
| 17 | + ut_assert.is_null('['||a_msg||'('||i||')]Check annotation param value',a_actual(i).value); |
| 18 | + end if; |
| 19 | + end loop; |
| 20 | + end if; |
| 21 | + end; |
| 22 | + |
| 23 | + procedure check_annotations(a_msg varchar2, a_expected ut_annotations.tt_annotations, a_actual ut_annotations.tt_annotations) is |
| 24 | + l_ind varchar2(500); |
| 25 | + begin |
| 26 | + ut_assert.are_equal('['||a_msg||']Check number of annotations parsed',a_expected.count,a_actual.count); |
| 27 | + |
| 28 | + if a_expected.count = a_actual.count and a_expected.count > 0 then |
| 29 | + l_ind := a_expected.first; |
| 30 | + while l_ind is not null loop |
| 31 | + |
| 32 | + ut_assert.this('['||a_msg||']Check annotation exists', a_actual.exists(l_ind)); |
| 33 | + if a_actual.exists(l_ind) then |
| 34 | + check_annotation_params(a_msg||'.'||l_ind,a_expected(l_ind),a_actual(l_ind)); |
| 35 | + end if; |
| 36 | + l_ind := a_expected.next(l_ind); |
| 37 | + end loop; |
| 38 | + end if; |
| 39 | + end; |
| 40 | + |
| 41 | + procedure check_procedures(a_msg varchar2, a_expected ut_annotations.tt_procedure_annotations, a_actual ut_annotations.tt_procedure_annotations) is |
| 42 | + l_ind varchar2(500); |
| 43 | + begin |
| 44 | + ut_assert.are_equal('['||a_msg||']Check number of procedures parsed',a_expected.count,a_actual.count); |
| 45 | + |
| 46 | + if a_expected.count = a_actual.count and a_expected.count > 0 then |
| 47 | + l_ind := a_expected.first; |
| 48 | + while l_ind is not null loop |
| 49 | + |
| 50 | + ut_assert.this('['||a_msg||']Check procedure exists', a_actual.exists(l_ind)); |
| 51 | + if a_actual.exists(l_ind) then |
| 52 | + check_annotations(a_msg||'.'||l_ind,a_expected(l_ind),a_actual(l_ind)); |
| 53 | + end if; |
| 54 | + l_ind := a_expected.next(l_ind); |
| 55 | + end loop; |
| 56 | + end if; |
| 57 | + end; |
| 58 | +begin |
| 59 | + check_annotations('PACKAGE',a_expected.package_annotations,a_parsing_result.package_annotations); |
| 60 | + check_procedures('PROCEDURES',a_expected.procedure_annotations,a_parsing_result.procedure_annotations); |
| 61 | +end check_annotation_parsing; |
| 62 | +/ |
0 commit comments