diff options
author | zimmerma <zimmerma@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2009-03-20 16:05:48 +0000 |
---|---|---|
committer | zimmerma <zimmerma@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2009-03-20 16:05:48 +0000 |
commit | 5d5659ecb95f76a69964bbd240b783b560b576cc (patch) | |
tree | c20da72048f25e0bbd221937a3fa71413867f215 /tests/treimref.c | |
parent | 5d6b215e5a3d54e62c1e30869dfc7d1a9a2299c7 (diff) | |
download | mpc-5d5659ecb95f76a69964bbd240b783b560b576cc.tar.gz |
[treimref.c] test file for mpc_realref and mpc_imagref
[mpc.h] fixed definition of mpc_realref and mpc_imagref
[mpc.texi] added comment about mpfr_t which is a pointer
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@494 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/treimref.c')
-rw-r--r-- | tests/treimref.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/treimref.c b/tests/treimref.c new file mode 100644 index 0000000..e6779a9 --- /dev/null +++ b/tests/treimref.c @@ -0,0 +1,49 @@ +/* test file for mpc_realref and mpc_imagref. + +Copyright (C) 2009 Paul Zimmermann + +This file is part of the MPC Library. + +The MPC Library 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 2.1 of the License, or (at your +option) any later version. + +The MPC Library 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 the MPC Library; see the file COPYING.LIB. If not, write to +the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +MA 02111-1307, USA. */ + +#include "mpc-tests.h" + +int +main (void) +{ + mpc_t z; + + test_start (); + test_end (); + + mpc_init2 (z, 6); + mpc_set_ui_ui (z, 17, 42, MPC_RNDNN); + mpfr_set_ui (mpc_realref (z), 18, GMP_RNDN); + if (mpfr_get_ui (mpc_realref (z), GMP_RNDN) != 18) + { + fprintf (stderr, "Error in mpfr_set_ui/mpc_realref\n"); + exit (1); + } + mpfr_set_ui (mpc_imagref (z), 43, GMP_RNDN); + if (mpfr_get_ui (mpc_imagref (z), GMP_RNDN) != 43) + { + fprintf (stderr, "Error in mpfr_set_ui/mpc_imagref\n"); + exit (1); + } + mpc_clear (z); + + return 0; +} |