diff options
author | thevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2013-12-03 16:46:06 +0000 |
---|---|---|
committer | thevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2013-12-03 16:46:06 +0000 |
commit | 10583b7e0b33a3eda47ea733d88985bf2e482e6c (patch) | |
tree | 057b586ae3958ac050a98b9b2e98cff025d97510 | |
parent | 40c8f986c285637cf6d7f9d929a07d86ab11ae25 (diff) | |
download | mpc-10583b7e0b33a3eda47ea733d88985bf2e482e6c.tar.gz |
[tests/] Add templated tests for mpc_pow_d.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/branches/benchs_tests@1376 211d60ee-9f03-0410-a15a-8952a2c7a4e4
-rw-r--r-- | tests/Makefile.am | 10 | ||||
-rw-r--r-- | tests/pow_d.dsc | 30 | ||||
-rw-r--r-- | tests/tpow_d_tmpl.c | 76 |
3 files changed, 111 insertions, 5 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 39a96b7..cff9d40 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -34,8 +34,8 @@ TEMPLATED = tabs_tmpl tacos_tmpl tacosh_tmpl tadd_fr_tmpl tadd_tmpl \ tdiv_2ui_tmpl tdiv_fr_tmpl tdiv_ui_tmpl texp_tmpl tfma_tmpl \ tfr_div_tmpl tfr_sub_tmpl timag_tmpl tlog10_tmpl tlog_tmpl \ tlog10_tmpl tmul_tmpl tmul_2si_tmpl tmul_2ui_tmpl tmul_fr_tmpl \ - tmul_i_tmpl tmul_si_tmpl tmul_ui_tmpl tneg_tmpl tnorm_tmpl \ - tpow_fr_tmpl tpow_si_tmpl tpow_tmpl tpow_ui_tmpl tpow_z_tmpl \ + tmul_i_tmpl tmul_si_tmpl tmul_ui_tmpl tneg_tmpl tnorm_tmpl tpow_tmpl \ + tpow_d_tmpl tpow_fr_tmpl tpow_si_tmpl tpow_ui_tmpl tpow_z_tmpl \ tproj_tmpl treal_tmpl tsin_tmpl tsinh_tmpl tsub_fr_tmpl tsub_tmpl \ ttan_tmpl ttanh_tmpl check_PROGRAMS = tabs tacos tacosh tadd tadd_fr tadd_si tadd_ui targ \ @@ -59,9 +59,9 @@ DESCRIPTIONS = abs.dsc acos.dsc acosh.dsc add.dsc add_fr.dsc add_si.dsc \ cos.dsc cosh.dsc div.dsc div_2si.dsc div_2ui.dsc div_fr.dsc \ div_ui.dsc exp.dsc fma.dsc fr_div.dsc fr_sub.dsc imag.dsc log.dsc \ log10.dsc mul.dsc mul_2si.dsc mul_2ui.dsc mul_fr.dsc mul_i.dsc \ - mul_si.dsc mul_ui.dsc neg.dsc norm.dsc pow.dsc pow_fr.dsc pow_si.dsc \ - pow_ui.dsc pow_z.dsc proj.dsc real.dsc sin.dsc sinh.dsc sub.dsc \ - sub_fr.dsc tan.dsc tanh.dsc + mul_si.dsc mul_ui.dsc neg.dsc norm.dsc pow.dsc pow_d.dsc pow_fr.dsc \ + pow_si.dsc pow_ui.dsc pow_z.dsc proj.dsc real.dsc sin.dsc sinh.dsc \ + sub.dsc sub_fr.dsc tan.dsc tanh.dsc DATA_SETS = abs.dat acos.dat acosh.dat add.dat add_fr.dat arg.dat \ asin.dat asinh.dat atan.dat atanh.dat conj.dat cos.dat cosh.dat \ div.dat div_fr.dat exp.dat fma.dat fr_div.dat fr_sub.dat inp_str.dat \ diff --git a/tests/pow_d.dsc b/tests/pow_d.dsc new file mode 100644 index 0000000..cb04e98 --- /dev/null +++ b/tests/pow_d.dsc @@ -0,0 +1,30 @@ +# Description file for mpc_pow_d +# +# Copyright (C) 2013 INRIA +# +# This file is part of GNU MPC. +# +# GNU MPC is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +#o ption) any later version. +# +# GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +# more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see http://www.gnu.org/licenses/ . +# +# Description file of the function +NAME: + mpc_pow_d +RETURN: + mpc_inex +OUTPUT: + mpc_ptr +INPUT: + mpc_srcptr + double + mpc_rnd_t diff --git a/tests/tpow_d_tmpl.c b/tests/tpow_d_tmpl.c new file mode 100644 index 0000000..6122876 --- /dev/null +++ b/tests/tpow_d_tmpl.c @@ -0,0 +1,76 @@ +/* tpow_d_tmpl.c -- templated test file for mpc_pow_d. + +Copyright (C) 2009, 2013 INRIA + +This file is part of GNU MPC. + +GNU MPC is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +more details. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see http://www.gnu.org/licenses/ . +*/ + +#include "templates.h" + +static void +test_integer_values (void) +{ + mpc_t z; + + mpc_init2 (z, 11); + + mpc_set_ui_ui (z, 2, 3, MPC_RNDNN); + mpc_pow_d (z, z, 3.0, MPC_RNDNN); + if (mpc_cmp_si_si (z, -46, 9) != 0) + { + printf ("Error for mpc_pow_d (1)\n"); + exit (1); + } + + mpc_set_si_si (z, -3, 4, MPC_RNDNN); + mpc_pow_d (z, z, 0.5, MPC_RNDNN); + if (mpc_cmp_si_si (z, 1, 2) != 0) + { + printf ("Error for mpc_pow_d (2)\n"); + exit (1); + } + + mpc_set_ui_ui (z, 2, 3, MPC_RNDNN); + mpc_pow_d (z, z, 6.0, MPC_RNDNN); + if (mpc_cmp_si_si (z, 2035, -828) != 0) + { + printf ("Error for mpc_pow_d (3)\n"); + exit (1); + } + + mpc_clear (z); +} + +#define MPC_FUNCTION_CALL \ + P[0].mpc_inex = mpc_pow_d (P[1].mpc, P[2].mpc, P[3].d, P[4].mpc_rnd) +#define MPC_FUNCTION_CALL_REUSE_OP1 \ + P[0].mpc_inex = mpc_pow_d (P[1].mpc, P[1].mpc, P[3].d, P[4].mpc_rnd) + +#include "tgeneric.tpl" + +int +main (void) +{ + test_start (); + + tgeneric_template ("pow_d.dsc", 2, 1024, 15, 20); + + test_integer_values (); /* FIXME: should be in a data file */ + + test_end (); + + return 0; +} |