diff --git a/codecov.yml b/codecov.yml index 9949656996..027d5eef42 100644 --- a/codecov.yml +++ b/codecov.yml @@ -8,6 +8,8 @@ coverage: - doc status: patch: - default: {} + default: + target: 70% project: - default: {} + default: + target: 70% diff --git a/src/json_file_module.F90 b/src/json_file_module.F90 index 330056d11e..179b775975 100644 --- a/src/json_file_module.F90 +++ b/src/json_file_module.F90 @@ -78,6 +78,7 @@ module json_file_module procedure,public :: destroy => json_file_destroy procedure,public :: move => json_file_move_pointer generic,public :: info => MAYBEWRAP(json_file_variable_info) + generic,public :: matrix_info => MAYBEWRAP(json_file_variable_matrix_info) !error checking: procedure,public :: failed => json_file_failed @@ -125,8 +126,9 @@ module json_file_module procedure :: initialize_json_core_in_file procedure :: set_json_core_in_file - !git info: + !get info: procedure :: MAYBEWRAP(json_file_variable_info) + procedure :: MAYBEWRAP(json_file_variable_matrix_info) !get: procedure :: MAYBEWRAP(json_file_get_object) @@ -648,61 +650,113 @@ end subroutine json_file_print_to_string ! date: 2/3/2014 ! ! Returns information about a variable in a [[json_file(type)]]. +! +!@note If `found` is present, no exceptions will be thrown if an +! error occurs. Otherwise, an exception will be thrown if the +! variable is not found. - subroutine json_file_variable_info(me,path,found,var_type,n_children) + subroutine json_file_variable_info(me,path,found,var_type,n_children,name) implicit none class(json_file),intent(inout) :: me character(kind=CK,len=*),intent(in) :: path !! path to the variable - logical(LK),intent(out) :: found !! the variable exists in the structure - integer(IK),intent(out) :: var_type !! variable type - integer(IK),intent(out) :: n_children !! number of children + logical(LK),intent(out),optional :: found !! the variable exists in the structure + integer(IK),intent(out),optional :: var_type !! variable type + integer(IK),intent(out),optional :: n_children !! number of children + character(kind=CK,len=:),allocatable,intent(out),optional :: name !! variable name - type(json_value),pointer :: p + call me%core%info(me%p,path,found,var_type,n_children,name) - !initialize: - nullify(p) + end subroutine json_file_variable_info +!***************************************************************************************** - !get a pointer to the variable (if it is there): - call me%get(path,p,found) +!***************************************************************************************** +!> +! Alternate version of [[json_file_variable_info]], where "path" is kind=CDK. +! +!@note If `found` is present, no exceptions will be thrown if an +! error occurs. Otherwise, an exception will be thrown if the +! variable is not found. - if (found) then + subroutine wrap_json_file_variable_info(me,path,found,var_type,n_children,name) - !get info: - call me%core%info(p,var_type,n_children) + implicit none - else + class(json_file),intent(inout) :: me + character(kind=CDK,len=*),intent(in) :: path + logical(LK),intent(out),optional :: found + integer(IK),intent(out),optional :: var_type + integer(IK),intent(out),optional :: n_children + character(kind=CK,len=:),allocatable,intent(out),optional :: name !! variable name - !set to dummy values: - var_type = json_unknown - n_children = 0 + call me%info(to_unicode(path),found,var_type,n_children,name) - end if + end subroutine wrap_json_file_variable_info +!***************************************************************************************** - !cleanup: - nullify(p) +!***************************************************************************************** +!> author: Jacob Williams +! date: 6/26/2016 +! +! Returns matrix information about a variable in a [[json_file(type)]]. +! +!@note If `found` is present, no exceptions will be thrown if an +! error occurs. Otherwise, an exception will be thrown if the +! variable is not found. - end subroutine json_file_variable_info + subroutine json_file_variable_matrix_info(me,path,is_matrix,found,& + var_type,n_sets,set_size,name) + + implicit none + + class(json_file),intent(inout) :: me + character(kind=CK,len=*),intent(in) :: path !! path to the variable + logical(LK),intent(out) :: is_matrix !! true if it is a valid matrix + logical(LK),intent(out),optional :: found !! true if it was found + integer(IK),intent(out),optional :: var_type !! variable type of data in + !! the matrix (if all elements have + !! the same type) + integer(IK),intent(out),optional :: n_sets !! number of data sets (i.e., matrix + !! rows if using row-major order) + integer(IK),intent(out),optional :: set_size !! size of each data set (i.e., matrix + !! cols if using row-major order) + character(kind=CK,len=:),allocatable,intent(out),optional :: name !! variable name + + call me%core%matrix_info(me%p,path,is_matrix,found,var_type,n_sets,set_size,name) + + end subroutine json_file_variable_matrix_info !***************************************************************************************** !***************************************************************************************** !> -! Alternate version of [[json_file_variable_info]], where "path" is kind=CDK. +! Alternate version of [[json_file_variable_matrix_info]], where "path" is kind=CDK. +! +!@note If `found` is present, no exceptions will be thrown if an +! error occurs. Otherwise, an exception will be thrown if the +! variable is not found. - subroutine wrap_json_file_variable_info(me,path,found,var_type,n_children) + subroutine wrap_json_file_variable_matrix_info(me,path,is_matrix,found,& + var_type,n_sets,set_size,name) implicit none class(json_file),intent(inout) :: me - character(kind=CDK,len=*),intent(in) :: path - logical(LK),intent(out) :: found - integer(IK),intent(out) :: var_type - integer(IK),intent(out) :: n_children - - call me%info(to_unicode(path),found,var_type,n_children) - - end subroutine wrap_json_file_variable_info + character(kind=CDK,len=*),intent(in) :: path !! path to the variable + logical(LK),intent(out) :: is_matrix !! true if it is a valid matrix + logical(LK),intent(out),optional :: found !! true if it was found + integer(IK),intent(out),optional :: var_type !! variable type of data in + !! the matrix (if all elements have + !! the same type) + integer(IK),intent(out),optional :: n_sets !! number of data sets (i.e., matrix + !! rows if using row-major order) + integer(IK),intent(out),optional :: set_size !! size of each data set (i.e., matrix + !! cols if using row-major order) + character(kind=CK,len=:),allocatable,intent(out),optional :: name !! variable name + + call me%matrix_info(to_unicode(path),is_matrix,found,var_type,n_sets,set_size,name) + + end subroutine wrap_json_file_variable_matrix_info !***************************************************************************************** !***************************************************************************************** diff --git a/src/json_value_module.F90 b/src/json_value_module.F90 index 676551072b..74071f5c5b 100644 --- a/src/json_value_module.F90 +++ b/src/json_value_module.F90 @@ -505,6 +505,18 @@ module json_value_module generic,public :: rename => MAYBEWRAP(json_value_rename) procedure :: MAYBEWRAP(json_value_rename) + !> + ! get info about a [[json_value]] + generic,public :: info => json_info, MAYBEWRAP(json_info_by_path) + procedure :: json_info + procedure :: MAYBEWRAP(json_info_by_path) + + !> + ! get matrix info about a [[json_value]] + generic,public :: matrix_info => json_matrix_info, MAYBEWRAP(json_matrix_info_by_path) + procedure :: json_matrix_info + procedure :: MAYBEWRAP(json_matrix_info_by_path) + procedure,public :: remove => json_value_remove !! Remove a [[json_value]] from a linked-list structure. procedure,public :: check_for_errors => json_check_for_errors !! check for error and get error message procedure,public :: clear_exceptions => json_clear_exceptions !! clear exceptions @@ -515,7 +527,6 @@ module json_value_module procedure,public :: get_next => json_get_next !! get pointer to json_value next procedure,public :: get_previous => json_get_previous !! get pointer to json_value previous procedure,public :: get_tail => json_get_tail !! get pointer to json_value tail - procedure,public :: info => json_info !! get info about a json_value procedure,public :: initialize => json_initialize !! to initialize some parsing parameters procedure,public :: traverse => json_traverse !! to traverse all elements of a JSON structure procedure,public :: print_error_message => json_print_error_message !! simply routine to print error messages @@ -979,6 +990,329 @@ subroutine json_info(json,p,var_type,n_children,name) end subroutine json_info !***************************************************************************************** +!***************************************************************************************** +! +! Returns information about a [[json_value]], given the path. +! +!### See also +! * [[json_info]] +! +!@note If `found` is present, no exceptions will be thrown if an +! error occurs. Otherwise, an exception will be thrown if the +! variable is not found. + + subroutine json_info_by_path(json,p,path,found,var_type,n_children,name) + + implicit none + + class(json_core),intent(inout) :: json + type(json_value),pointer,intent(in) :: p !! a JSON linked list + character(kind=CK,len=*),intent(in) :: path !! path to the variable + logical(LK),intent(out),optional :: found !! true if it was found + integer(IK),intent(out),optional :: var_type !! variable type + integer(IK),intent(out),optional :: n_children !! number of children + character(kind=CK,len=:),allocatable,intent(out),optional :: name !! variable name + + type(json_value),pointer :: p_var + logical(LK) :: ok +#if defined __GFORTRAN__ + character(kind=CK,len=:),allocatable :: p_name +#endif + + call json%get(p,path,p_var,found) + + !check if it was found: + if (present(found)) then + ok = found + else + ok = .not. json%failed() + end if + + if (.not. ok) then + if (present(var_type)) var_type = json_unknown + if (present(n_children)) n_children = 0 + if (present(name)) name = '' + else + !get info: + +#if defined __GFORTRAN__ + call json%info(p_var,var_type,n_children) + if (present(name)) then !workaround for gfortran bug + if (allocated(p_var%name)) then + p_name = p_var%name + name = p_name + else + name = '' + end if + end if +#else + call json%info(p_var,var_type,n_children,name) +#endif + + end if + + end subroutine json_info_by_path +!***************************************************************************************** + +!***************************************************************************************** +!> +! Alternate version of [[json_info_by_path]] where "path" is kind=CDK. + + subroutine wrap_json_info_by_path(json,p,path,found,var_type,n_children,name) + + implicit none + + class(json_core),intent(inout) :: json + type(json_value),pointer,intent(in) :: p !! a JSON linked list + character(kind=CDK,len=*),intent(in) :: path !! path to the variable + logical(LK),intent(out),optional :: found !! true if it was found + integer(IK),intent(out),optional :: var_type !! variable type + integer(IK),intent(out),optional :: n_children !! number of children + character(kind=CK,len=:),allocatable,intent(out),optional :: name !! variable name + + call json%info(p,to_unicode(path),found,var_type,n_children,name) + + end subroutine wrap_json_info_by_path +!***************************************************************************************** + +!***************************************************************************************** +!> author: Jacob Williams +! date: 10/16/2015 +! +! Alternate version of [[json_info]] that returns matrix +! information about a [[json_value]]. +! +! A [[json_value]] is a valid rank 2 matrix if all of the following are true: +! +! * The var_type is *json_array* +! * Each child is also a *json_array*, each of which has the same number of elements +! * Each individual element has the same variable type (integer, logical, etc.) +! +! The idea here is that if it is a valid matrix, it can be interoperable with +! a Fortran rank 2 array of the same type. +! +!# Example +! +! The following example is an array with `var_type=json_integer`, `n_sets=3`, and `set_size=4` +! +!```json +! { +! "matrix": [ +! [1,2,3,4], +! [5,6,7,8], +! [9,10,11,12] +! ] +! } +!``` + + subroutine json_matrix_info(json,p,is_matrix,var_type,n_sets,set_size,name) + + implicit none + + class(json_core),intent(inout) :: json + type(json_value),pointer :: p !! a JSON linked list + logical(LK),intent(out) :: is_matrix !! true if it is a valid matrix + integer(IK),intent(out),optional :: var_type !! variable type of data in the matrix (if all elements have the same type) + integer(IK),intent(out),optional :: n_sets !! number of data sets (i.e., matrix rows if using row-major order) + integer(IK),intent(out),optional :: set_size !! size of each data set (i.e., matrix cols if using row-major order) + character(kind=CK,len=:),allocatable,intent(out),optional :: name !! variable name + + type(json_value),pointer :: p_row !! for getting a set + type(json_value),pointer :: p_element !! for getting an element in a set + integer(IK) :: vartype !! json variable type of `p` + integer(IK) :: row_vartype !! json variable type of a row + integer(IK) :: element_vartype !! json variable type of an element in a row + integer(IK) :: nr !! number of children of `p` + integer(IK) :: nc !! number of elements in first child of `p` + integer(IK) :: icount !! number of elements in a set + integer :: i !! counter + integer :: j !! counter +#if defined __GFORTRAN__ + character(kind=CK,len=:),allocatable :: p_name +#endif + + !get info about the variable: +#if defined __GFORTRAN__ + call json%info(p,vartype,nr) + if (present(name)) then !workaround for gfortran bug + if (allocated(p%name)) then + p_name = p%name + name = p_name + else + name = '' + end if + end if +#else + call json%info(p,vartype,nr,name) +#endif + + is_matrix = (vartype==json_array) + + if (is_matrix) then + + main : do i=1,nr + + nullify(p_row) + call json%get_child(p,i,p_row) + if (.not. associated(p_row)) then + is_matrix = .false. + call json%throw_exception('Error in json_matrix_info: '//& + 'Malformed JSON linked list') + exit main + end if + call json%info(p_row,var_type=row_vartype,n_children=icount) + + if (row_vartype==json_array) then + if (i==1) nc = icount !number of columns in first row + if (icount==nc) then !make sure each row has the same number of columns + !see if all the variables in this row are the same type: + do j=1,icount + nullify(p_element) + call json%get_child(p_row,j,p_element) + if (.not. associated(p_element)) then + is_matrix = .false. + call json%throw_exception('Error in json_matrix_info: '//& + 'Malformed JSON linked list') + exit main + end if + call json%info(p_element,var_type=element_vartype) + if (i==1 .and. j==1) vartype = element_vartype !type of first element + !in the row + if (vartype/=element_vartype) then + !not all variables are the same time + is_matrix = .false. + exit main + end if + end do + else + is_matrix = .false. + exit main + end if + else + is_matrix = .false. + exit main + end if + + end do main + + end if + + if (is_matrix) then + if (present(var_type)) var_type = vartype + if (present(n_sets)) n_sets = nr + if (present(set_size)) set_size = nc + else + if (present(var_type)) var_type = json_unknown + if (present(n_sets)) n_sets = 0 + if (present(set_size)) set_size = 0 + end if + + end subroutine json_matrix_info +!***************************************************************************************** + +!***************************************************************************************** +!> +! Returns matrix information about a [[json_value]], given the path. +! +!### See also +! * [[json_matrix_info]] +! +!@note If `found` is present, no exceptions will be thrown if an +! error occurs. Otherwise, an exception will be thrown if the +! variable is not found. + + subroutine json_matrix_info_by_path(json,p,path,is_matrix,found,& + var_type,n_sets,set_size,name) + + implicit none + + class(json_core),intent(inout) :: json + type(json_value),pointer :: p !! a JSON linked list + character(kind=CK,len=*),intent(in) :: path !! path to the variable + logical(LK),intent(out) :: is_matrix !! true if it is a valid matrix + logical(LK),intent(out),optional :: found !! true if it was found + integer(IK),intent(out),optional :: var_type !! variable type of data in + !! the matrix (if all elements have + !! the same type) + integer(IK),intent(out),optional :: n_sets !! number of data sets (i.e., matrix + !! rows if using row-major order) + integer(IK),intent(out),optional :: set_size !! size of each data set (i.e., matrix + !! cols if using row-major order) + character(kind=CK,len=:),allocatable,intent(out),optional :: name !! variable name + + type(json_value),pointer :: p_var + logical(LK) :: ok +#if defined __GFORTRAN__ + character(kind=CK,len=:),allocatable :: p_name +#endif + + call json%get(p,path,p_var,found) + + !check if it was found: + if (present(found)) then + ok = found + else + ok = .not. json%failed() + end if + + if (.not. ok) then + if (present(var_type)) var_type = json_unknown + if (present(n_sets)) n_sets = 0 + if (present(set_size)) set_size = 0 + if (present(name)) name = '' + else + + !get info about the variable: +#if defined __GFORTRAN__ + call json%matrix_info(p_var,is_matrix,var_type,n_sets,set_size) + if (present(name)) then !workaround for gfortran bug + if (allocated(p_var%name)) then + p_name = p_var%name + name = p_name + else + name = '' + end if + end if +#else + call json%matrix_info(p_var,is_matrix,var_type,n_sets,set_size,name) +#endif + if (json%failed() .and. present(found)) then + found = .false. + call json%clear_exceptions() + end if + end if + + end subroutine json_matrix_info_by_path +!***************************************************************************************** + +!***************************************************************************************** +!> +! Alternate version of [[json_matrix_info_by_path]] where "path" is kind=CDK. + + subroutine wrap_json_matrix_info_by_path(json,p,path,is_matrix,found,& + var_type,n_sets,set_size,name) + + implicit none + + class(json_core),intent(inout) :: json + type(json_value),pointer :: p !! a JSON linked list + character(kind=CDK,len=*),intent(in) :: path !! path to the variable + logical(LK),intent(out) :: is_matrix !! true if it is a valid matrix + logical(LK),intent(out),optional :: found !! true if it was found + integer(IK),intent(out),optional :: var_type !! variable type of data in + !! the matrix (if all elements have + !! the same type) + integer(IK),intent(out),optional :: n_sets !! number of data sets (i.e., matrix + !! rows if using row-major order) + integer(IK),intent(out),optional :: set_size !! size of each data set (i.e., matrix + !! cols if using row-major order) + character(kind=CK,len=:),allocatable,intent(out),optional :: name !! variable name + + call json%matrix_info(p,to_unicode(path),is_matrix,found,var_type,n_sets,set_size,name) + + end subroutine wrap_json_matrix_info_by_path +!***************************************************************************************** + !***************************************************************************************** !> author: Jacob Williams ! date: 4/29/2016 diff --git a/src/tests/jf_test_10.f90 b/src/tests/jf_test_10.f90 index 7baa75a6e8..804af45d4a 100644 --- a/src/tests/jf_test_10.f90 +++ b/src/tests/jf_test_10.f90 @@ -87,7 +87,7 @@ subroutine test_10(error_cnt) end if write(error_unit,'(A)') 'json_file_variable_info...' - call f%info('blah',found,var_type,n_children) + call f%info('blah',found,var_type,n_children,name) if (f%failed()) then call f%print_error_message(error_unit) error_cnt = error_cnt + 1 diff --git a/src/tests/jf_test_19.f90 b/src/tests/jf_test_19.f90 new file mode 100644 index 0000000000..eea7a2b025 --- /dev/null +++ b/src/tests/jf_test_19.f90 @@ -0,0 +1,177 @@ +!***************************************************************************************** +!> author: Jacob Williams +! date: 6/25/2016 +! +! Test the matrix info routines. + +module jf_test_19_mod + + use json_module, lk => json_lk, rk => json_rk, ik => json_ik,& + ck => json_ck, cdk => json_cdk + use, intrinsic :: iso_fortran_env , only: error_unit,output_unit + + implicit none + +contains + + subroutine test_19(error_cnt) + + implicit none + + integer,intent(out) :: error_cnt !! report number of errors to caller + + type(json_core) :: json + type(json_value),pointer :: p,p_matrix + logical(lk) :: is_matrix,found + integer(ik) :: var_type,n_sets,set_size + character(kind=CK,len=:),allocatable :: name + + !> + ! Example JSON matrix data + character(kind=CK,len=*),parameter :: json_example = & + '{'//& + ' "matrix": ['//& + ' [1,2,3,4],'//& + ' [1,2,3,4],'//& + ' [1,2,3,4]'//& + ' ]'//& + '}' + + write(error_unit,'(A)') '' + write(error_unit,'(A)') '=================================' + write(error_unit,'(A)') ' TEST 19' + write(error_unit,'(A)') '=================================' + write(error_unit,'(A)') '' + + error_cnt = 0 + + write(error_unit,'(A)') '' + write(error_unit,'(A)') '-------------' + write(error_unit,'(A)') 'JSON data:' + write(error_unit,'(A)') '-------------' + write(error_unit,'(A)') '' + call json%parse(p,json_example) + call json%print(p,error_unit) + + !get some info: + call json%get(p,ck_'matrix',p_matrix) + call json%matrix_info(p_matrix,is_matrix,var_type,n_sets,set_size,name) + + if (json%failed()) then + call json%print_error_message(error_unit) + error_cnt = error_cnt + 1 + else + if (is_matrix .and. & + var_type==json_integer .and. & + n_sets==3 .and. & + set_size==4 .and. & + name=='matrix') then + write(error_unit,'(A)') '...success' + else + write(error_unit,'(A)') 'Error getting matrix info:' + write(error_unit,*) 'is_matrix:',is_matrix + write(error_unit,*) 'var_type :',var_type + write(error_unit,*) 'n_sets :',n_sets + write(error_unit,*) 'set_size :',set_size + write(error_unit,*) 'name :'//name + error_cnt = error_cnt + 1 + end if + end if + + !now test with a variable that is NOT a matrix: + call json%get(p,ck_'matrix(1)',p_matrix) + call json%matrix_info(p_matrix,is_matrix,var_type,n_sets,set_size,name) + if (json%failed()) then + call json%print_error_message(error_unit) + error_cnt = error_cnt + 1 + else + if (.not. is_matrix) then + write(error_unit,'(A)') '...success' + else + write(error_unit,'(A)') 'Error: this should not be a matrix' + error_cnt = error_cnt + 1 + end if + end if + + ! now, test by path: + call json%matrix_info(p,ck_'matrix',is_matrix,& + var_type=var_type,n_sets=n_sets,& + set_size=set_size,name=name) + + if (json%failed()) then + call json%print_error_message(error_unit) + error_cnt = error_cnt + 1 + else + if (is_matrix .and. & + var_type==json_integer .and. & + n_sets==3 .and. & + set_size==4 .and. & + name=='matrix') then + write(error_unit,'(A)') '...success' + else + write(error_unit,'(A)') 'Error getting matrix info by path:' + write(error_unit,*) 'is_matrix:',is_matrix + write(error_unit,*) 'var_type :',var_type + write(error_unit,*) 'n_sets :',n_sets + write(error_unit,*) 'set_size :',set_size + write(error_unit,*) 'name :'//name + error_cnt = error_cnt + 1 + end if + end if + + !also test with "found" input: + call json%matrix_info(p,ck_'matrix',is_matrix,found=found,& + var_type=var_type,n_sets=n_sets,& + set_size=set_size,name=name) + if (found) then + write(error_unit,'(A)') '...success' + + !test again with CDK path (for unicode wrapper) + call json%matrix_info(p,CDK_'matrix',is_matrix,found=found,& + var_type=var_type,n_sets=n_sets,& + set_size=set_size,name=name) + + + else + write(error_unit,*) 'error calling json_matrix_info_by_path with found input' + error_cnt = error_cnt + 1 + end if + + !now test with a variable that is NOT a matrix: + call json%matrix_info(p,ck_'matrix(1)',is_matrix,found=found,& + var_type=var_type,n_sets=n_sets,& + set_size=set_size,name=name) + if (.not. is_matrix) then + write(error_unit,'(A)') '...success' + else + write(error_unit,'(A)') 'Error: this should not be a matrix:' + error_cnt = error_cnt + 1 + end if + + ! cleanup: + call json%destroy(p) + + write(error_unit,'(A)') '' + write(error_unit,'(A)') '=================================' + write(error_unit,'(A)') '' + + end subroutine test_19 + +end module jf_test_19_mod +!***************************************************************************************** + +!***************************************************************************************** +program jf_test_19 + + !! 19th unit test. + + use jf_test_19_mod, only: test_19 + + implicit none + + integer :: n_errors + call test_19(n_errors) + if ( n_errors /= 0) stop 1 + +end program jf_test_19 +!***************************************************************************************** diff --git a/src/tests/jf_test_4.f90 b/src/tests/jf_test_4.f90 index b3fd2192f3..e3923a2e90 100644 --- a/src/tests/jf_test_4.f90 +++ b/src/tests/jf_test_4.f90 @@ -34,7 +34,9 @@ subroutine test_4(error_cnt) integer :: i character(kind=json_CK,len=10) :: istr - character(kind=json_CK,len=:),allocatable :: string + character(kind=json_CK,len=:),allocatable :: string,name + logical(json_LK) :: found + integer(json_IK) :: var_type,n_children error_cnt = 0 call core%initialize() @@ -104,6 +106,31 @@ subroutine test_4(error_cnt) write(output_unit,'(A)') string deallocate(string) !cleanup + write(error_unit,'(A)') '' + write(error_unit,'(A)') 'json_info_by_path' + write(error_unit,'(A)') '' + !get some info: + call core%info(p,'INPUTS',found,var_type,n_children,name) + if (found) then + !test again with CDK path (for unicode wrapper) + call core%info(p,json_cdk_'INPUTS',found,var_type,n_children,name) + else + write(error_unit,'(A)') 'Error getting info on INPUT' + error_cnt = error_cnt + 1 + end if + !test without found: + call core%info(p,'INPUTS',var_type=var_type,n_children=n_children,name=name) + if (core%failed()) then + call core%print_error_message(error_unit) + error_cnt = error_cnt + 1 + end if + !get with a variable that we know if not present: + call core%info(p,'BLAHBLAH',found,var_type,n_children,name) + if (found) then !should not be found + write(error_unit,'(A)') 'Error: BLAHBLAH should not be there' + error_cnt = error_cnt + 1 + end if + !cleanup: call core%destroy(p) if (core%failed()) then