diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2014-05-31 21:30:48 +0200 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2014-05-31 21:30:48 +0200 |
commit | ad4f3582f56491bbae04864d3d7776dc14fa34e8 (patch) | |
tree | 5b608a48df8506562fb6455e889ff71af741814c /tests/mpf | |
parent | 40de3099085dfbbb36370eeb199d99d814fe1a93 (diff) | |
download | gmp-ad4f3582f56491bbae04864d3d7776dc14fa34e8.tar.gz |
tests/mpf/t-sub.c: Test also zero ui.
Diffstat (limited to 'tests/mpf')
-rw-r--r-- | tests/mpf/t-sub.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/tests/mpf/t-sub.c b/tests/mpf/t-sub.c index df180f937..77f5025fa 100644 --- a/tests/mpf/t-sub.c +++ b/tests/mpf/t-sub.c @@ -155,6 +155,7 @@ check_data (void) { { 123, 4, { 8, 0, 0, 9 } }, { 123, 1, { 9 } }, { 120, 1, { 8 } } }, { { 123, 5, { 8, 0, 0, 0, 9 } }, { 123, 1, { 9 } }, { 119, 1, { 8 } } }, { { 123, 6, { 8, 0, 0, 0, 0, 9 } }, { 123, 1, { 9 } }, { 118, 1, { 8 } } }, + /* { { 123, 6, { 8, 0, 0, 0, 0, 9 } }, { 123, 6, { 9, 0, 0, 0, 0, 8 } }, { 122, 5, { W, W, W, W, W } } }, */ }; @@ -211,7 +212,7 @@ check_data (void) mpf_sub (got, x, y); /* MPF_CHECK_FORMAT (got); */ - if (mpf_cmp (got, want) != 0) + if (! refmpf_validate ("mpf_sub", got, want)) { printf ("check_data() wrong result at data[%d] (operands%s swapped)\n", i, swap ? "" : " not"); mpf_trace ("x ", x); @@ -221,13 +222,18 @@ check_data (void) fail = 1; } - if (SIZ (x) == 1) + if (SIZ (x) == 1 || SIZ (x) == 0 ) { - if (SIZ (y)) EXP (y) -= EXP (x) - 1; - if (SIZ (want)) EXP (want) -= EXP (x) - 1; - EXP (x) = 1; - mpf_ui_sub (got, * PTR (x), y); - + if (SIZ (x)) + { + if (SIZ (y)) EXP (y) -= EXP (x) - 1; + if (SIZ (want)) EXP (want) -= EXP (x) - 1; + EXP (x) = 1; + mpf_ui_sub (got, * PTR (x), y); + } + else + mpf_ui_sub (got, 0, y); + if (! refmpf_validate ("mpf_ui_sub", got, want)) { printf ("check_data() wrong result at data[%d] (operands%s swapped)\n", i, swap ? "" : " not"); @@ -239,12 +245,17 @@ check_data (void) } } - if (SIZ (y) == 1) + if (SIZ (y) == 1 || SIZ (y) == 0) { - if (SIZ (x)) EXP (x) -= EXP (y) - 1; - if (SIZ (want)) EXP (want) -= EXP (y) - 1; - EXP (y) = 1; - mpf_sub_ui (got, x, * PTR (y)); + if (SIZ (y)) + { + if (SIZ (x)) EXP (x) -= EXP (y) - 1; + if (SIZ (want)) EXP (want) -= EXP (y) - 1; + EXP (y) = 1; + mpf_sub_ui (got, x, * PTR (y)); + } + else + mpf_sub_ui (got, x, 0); if (! refmpf_validate ("mpf_ui_sub", got, want)) { |