1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-07-18 08:53:47 +02:00

Extended error arg list to 20 and restored nuclear charge test. #15

This commit is contained in:
vijay gopal chilkuri 2021-05-26 14:21:11 +05:30
parent 937d7aa9eb
commit 7924600602
3 changed files with 132 additions and 4 deletions

View File

@ -211,8 +211,8 @@ cppcheck --addon=cert --enable=all *.c &> cppcheck.out
included in the private header file which defines the type of the
context. Header files for private types are suffixed by =_private_type.h=
and header files for private functions are suffixed by =_private_func.h=.
Fortran interfaces should also be written in the =*_f_func.f90= file,
and the types definitions should be written in the =*_f_type.f90= file.
Fortran interfaces should also be written in the =*fh_func.f90= file,
and the types definitions should be written in the =*fh_type.f90= file.
| File | Scope | Description |
|--------------------+---------+------------------------------|
@ -220,8 +220,8 @@ cppcheck --addon=cert --enable=all *.c &> cppcheck.out
| =*_func.h= | Public | Function definitions |
| =*_private_type.h= | Private | Type definitions |
| =*_private_func.h= | Private | Function definitions |
| =*_f_type.f90= | Public | Fortran type definitions |
| =*_f_func.f90= | Public | Fortran function definitions |
| =*fh_type.f90= | Public | Fortran type definitions |
| =*fh_func.f90= | Public | Fortran function definitions |
** Low-level functions

View File

@ -88,6 +88,16 @@ typedef int32_t qmckl_exit_code;
| ~QMCKL_INVALID_ARG_8~ | 8 | 'Invalid argument 8' |
| ~QMCKL_INVALID_ARG_9~ | 9 | 'Invalid argument 9' |
| ~QMCKL_INVALID_ARG_10~ | 10 | 'Invalid argument 10' |
| ~QMCKL_INVALID_ARG_11~ | 11 | 'Invalid argument 11' |
| ~QMCKL_INVALID_ARG_12~ | 12 | 'Invalid argument 12' |
| ~QMCKL_INVALID_ARG_13~ | 13 | 'Invalid argument 13' |
| ~QMCKL_INVALID_ARG_14~ | 14 | 'Invalid argument 14' |
| ~QMCKL_INVALID_ARG_15~ | 15 | 'Invalid argument 15' |
| ~QMCKL_INVALID_ARG_16~ | 16 | 'Invalid argument 16' |
| ~QMCKL_INVALID_ARG_17~ | 17 | 'Invalid argument 17' |
| ~QMCKL_INVALID_ARG_18~ | 18 | 'Invalid argument 18' |
| ~QMCKL_INVALID_ARG_19~ | 19 | 'Invalid argument 19' |
| ~QMCKL_INVALID_ARG_20~ | 20 | 'Invalid argument 20' |
| ~QMCKL_FAILURE~ | 101 | 'Failure' |
| ~QMCKL_ERRNO~ | 102 | strerror(errno) |
| ~QMCKL_INVALID_CONTEXT~ | 103 | 'Invalid context' |
@ -136,6 +146,16 @@ return '\n'.join(result)
#define QMCKL_INVALID_ARG_8 ((qmckl_exit_code) 8)
#define QMCKL_INVALID_ARG_9 ((qmckl_exit_code) 9)
#define QMCKL_INVALID_ARG_10 ((qmckl_exit_code) 10)
#define QMCKL_INVALID_ARG_11 ((qmckl_exit_code) 11)
#define QMCKL_INVALID_ARG_12 ((qmckl_exit_code) 12)
#define QMCKL_INVALID_ARG_13 ((qmckl_exit_code) 13)
#define QMCKL_INVALID_ARG_14 ((qmckl_exit_code) 14)
#define QMCKL_INVALID_ARG_15 ((qmckl_exit_code) 15)
#define QMCKL_INVALID_ARG_16 ((qmckl_exit_code) 16)
#define QMCKL_INVALID_ARG_17 ((qmckl_exit_code) 17)
#define QMCKL_INVALID_ARG_18 ((qmckl_exit_code) 18)
#define QMCKL_INVALID_ARG_19 ((qmckl_exit_code) 19)
#define QMCKL_INVALID_ARG_20 ((qmckl_exit_code) 20)
#define QMCKL_FAILURE ((qmckl_exit_code) 101)
#define QMCKL_ERRNO ((qmckl_exit_code) 102)
#define QMCKL_INVALID_CONTEXT ((qmckl_exit_code) 103)
@ -157,6 +177,16 @@ return '\n'.join(result)
integer(qmckl_exit_code), parameter :: QMCKL_INVALID_ARG_8 = 8
integer(qmckl_exit_code), parameter :: QMCKL_INVALID_ARG_9 = 9
integer(qmckl_exit_code), parameter :: QMCKL_INVALID_ARG_10 = 10
integer(qmckl_exit_code), parameter :: QMCKL_INVALID_ARG_11 = 11
integer(qmckl_exit_code), parameter :: QMCKL_INVALID_ARG_12 = 12
integer(qmckl_exit_code), parameter :: QMCKL_INVALID_ARG_13 = 13
integer(qmckl_exit_code), parameter :: QMCKL_INVALID_ARG_14 = 14
integer(qmckl_exit_code), parameter :: QMCKL_INVALID_ARG_15 = 15
integer(qmckl_exit_code), parameter :: QMCKL_INVALID_ARG_16 = 16
integer(qmckl_exit_code), parameter :: QMCKL_INVALID_ARG_17 = 17
integer(qmckl_exit_code), parameter :: QMCKL_INVALID_ARG_18 = 18
integer(qmckl_exit_code), parameter :: QMCKL_INVALID_ARG_19 = 19
integer(qmckl_exit_code), parameter :: QMCKL_INVALID_ARG_20 = 20
integer(qmckl_exit_code), parameter :: QMCKL_FAILURE = 101
integer(qmckl_exit_code), parameter :: QMCKL_ERRNO = 102
integer(qmckl_exit_code), parameter :: QMCKL_INVALID_CONTEXT = 103
@ -204,6 +234,94 @@ return '\n'.join(result)
#+end_src
#+RESULTS: cases
#+begin_example
case QMCKL_SUCCESS:
return "Success";
break;
case QMCKL_INVALID_ARG_1:
return "Invalid argument 1";
break;
case QMCKL_INVALID_ARG_2:
return "Invalid argument 2";
break;
case QMCKL_INVALID_ARG_3:
return "Invalid argument 3";
break;
case QMCKL_INVALID_ARG_4:
return "Invalid argument 4";
break;
case QMCKL_INVALID_ARG_5:
return "Invalid argument 5";
break;
case QMCKL_INVALID_ARG_6:
return "Invalid argument 6";
break;
case QMCKL_INVALID_ARG_7:
return "Invalid argument 7";
break;
case QMCKL_INVALID_ARG_8:
return "Invalid argument 8";
break;
case QMCKL_INVALID_ARG_9:
return "Invalid argument 9";
break;
case QMCKL_INVALID_ARG_10:
return "Invalid argument 10";
break;
case QMCKL_INVALID_ARG_11:
return "Invalid argument 11";
break;
case QMCKL_INVALID_ARG_12:
return "Invalid argument 12";
break;
case QMCKL_INVALID_ARG_13:
return "Invalid argument 13";
break;
case QMCKL_INVALID_ARG_14:
return "Invalid argument 14";
break;
case QMCKL_INVALID_ARG_15:
return "Invalid argument 15";
break;
case QMCKL_INVALID_ARG_16:
return "Invalid argument 16";
break;
case QMCKL_INVALID_ARG_17:
return "Invalid argument 17";
break;
case QMCKL_INVALID_ARG_18:
return "Invalid argument 18";
break;
case QMCKL_INVALID_ARG_19:
return "Invalid argument 19";
break;
case QMCKL_INVALID_ARG_20:
return "Invalid argument 20";
break;
case QMCKL_FAILURE:
return "Failure";
break;
case QMCKL_ERRNO:
return strerror(errno);
break;
case QMCKL_INVALID_CONTEXT:
return "Invalid context";
break;
case QMCKL_ALLOCATION_FAILED:
return "Allocation failed";
break;
case QMCKL_DEALLOCATION_FAILED:
return "De-allocation failed";
break;
case QMCKL_NOT_PROVIDED:
return "Not provided";
break;
case QMCKL_INVALID_EXIT_CODE:
return "Invalid exit code";
break;
#+end_example
# Source
#+begin_src c :comments org :tangle (eval c) :noweb yes
const char* qmckl_string_of_error(const qmckl_exit_code error) {

View File

@ -1035,6 +1035,16 @@ qmckl_exit_code qmckl_compute_nucleus_repulsion (
*** Test
#+begin_src c :tangle (eval c_test)
/* Reference input data */
assert(qmckl_nucleus_provided(context));
double rep;
rc = qmckl_get_nucleus_repulsion(context, &rep);
assert(rep - 318.2309879436158 < 1.e-10);
#+end_src
* End of files :noexport: