star-wf

First-passage time of brownian motion
git clone git://git.meso-star.fr/star-wf.git
Log | Files | Refs | README | LICENSE

commit c1f7ca86fad7b1f0fa562ffe54873b0589c80acc
parent 7bf3e3b60734ff481fb2141d51f27ea9ce9de5e3
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed,  6 Mar 2024 18:57:22 +0100

Further tests on tabulation: check error handlings

Diffstat:
Msrc/test_swf_H3d.c | 27+++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/test_swf_H3d.c b/src/test_swf_H3d.c @@ -14,13 +14,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "swf.h" + #include <rsys/rsys.h> +#include <rsys/math.h> +#include <rsys/mem_allocator.h> /******************************************************************************* * Helper functions ******************************************************************************/ static void -check_tabulation(void) +check_tabulation_creation(void) { struct swf_H_tabulate_args args = SWF_H_TABULATE_ARGS_DEFAULT; struct swf_tabulation* tab = NULL; @@ -34,6 +37,25 @@ check_tabulation(void) CHK(swf_tabulation_ref_put(NULL) == RES_BAD_ARG); CHK(swf_tabulation_ref_put(tab) == RES_OK); CHK(swf_tabulation_ref_put(tab) == RES_OK); + + args.x_min = SWF_H_TABULATE_ARGS_DEFAULT.x_max; + args.x_max = SWF_H_TABULATE_ARGS_DEFAULT.x_min; + CHK(swf_H3d_tabulate(&args, &tab) == RES_BAD_ARG); + + args.x_max = args.x_min; + CHK(swf_H3d_tabulate(&args, &tab) == RES_BAD_ARG); + + args.x_min = SWF_H_TABULATE_ARGS_DEFAULT.x_min; + args.x_max = SWF_H_TABULATE_ARGS_DEFAULT.x_max; + args.delta_x = args.x_max - args.x_min + 1.e-3; + CHK(swf_H3d_tabulate(&args, &tab) == RES_BAD_ARG); + + args.delta_x = 0; + CHK(swf_H3d_tabulate(&args, &tab) == RES_BAD_ARG); + + args.delta_x = 1.0e-3; + CHK(swf_H3d_tabulate(&args, &tab) == RES_OK); + CHK(swf_tabulation_ref_put(tab) == RES_OK); } /******************************************************************************* @@ -43,6 +65,7 @@ int main(int argc, char** argv) { (void)argc, (void)argv; - check_tabulation(); + check_tabulation_creation(); + CHK(mem_allocated_size() == 0); return 0; }