summaryrefslogtreecommitdiff
path: root/tests/tget_str.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2017-06-02 15:36:52 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2017-06-02 15:36:52 +0000
commitc152948570fdcf1466ab7268c95baeb2d5183bc4 (patch)
treeffe5015b90be1bdd8cfc890f9b07ab7e9c1ff73b /tests/tget_str.c
parentb4904d423f3b6ae3e024ad1db0786447d986fa4d (diff)
downloadmpfr-c152948570fdcf1466ab7268c95baeb2d5183bc4.tar.gz
src/get_str.c: fixed for negative base
tests/tget_str.c: added tests for negative base git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11572 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tget_str.c')
-rw-r--r--tests/tget_str.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/tget_str.c b/tests/tget_str.c
index 42d3ce81f..76d197cb1 100644
--- a/tests/tget_str.c
+++ b/tests/tget_str.c
@@ -1248,6 +1248,23 @@ check_inex (void)
mpfr_clear (x);
}
+static void
+check_negative_base (void)
+{
+ mpfr_t f;
+ mpfr_exp_t e;
+ char *s, s2[16] = "7B000000000000", s3[16] = "74000000000000";
+
+ mpfr_init_set_ui (f, 123, MPFR_RNDN);
+ s = mpfr_get_str (0, &e, -16, 0, f, MPFR_RNDN);
+ MPFR_ASSERTN(strcmp (s, s2) == 0);
+ mpfr_free_str (s);
+ s = mpfr_get_str (0, &e, -17, 0, f, MPFR_RNDN);
+ MPFR_ASSERTN(strcmp (s, s3) == 0);
+ mpfr_free_str (s);
+ mpfr_clear (f);
+}
+
#define ITER 1000
int
@@ -1313,6 +1330,7 @@ main (int argc, char *argv[])
check_bug_base2k ();
check_reduced_exprange ();
check_inex ();
+ check_negative_base ();
tests_end_mpfr ();
return 0;