diff options
author | Jim Meyering <meyering@redhat.com> | 2008-08-08 10:02:34 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2008-08-09 16:55:45 +0200 |
commit | ae5ae5e117baa30d9ab33dafd51eb3900c28cea6 (patch) | |
tree | 2fe571439903a7853bd9642e23125e509d25ddde /tests/misc | |
parent | f65cafd67b33009d23f940968bbe7f9a08d6fe13 (diff) | |
download | coreutils-ae5ae5e117baa30d9ab33dafd51eb3900c28cea6.tar.xz |
* tests/misc/expr: Add tests of the new GMP-based code.
Diffstat (limited to 'tests/misc')
-rwxr-xr-x | tests/misc/expr | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/misc/expr b/tests/misc/expr index ab330e2cf..4d236621e 100755 --- a/tests/misc/expr +++ b/tests/misc/expr @@ -24,6 +24,11 @@ my $prog = 'expr'; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; +my $big = '98782897298723498732987928734'; +my $big_p1 = '98782897298723498732987928735'; +my $big_sum = '197565794597446997465975857469'; +my $big_prod = '9758060798730154302876482828124348356960410232492450771490'; + my @Tests = ( ['a', '5 + 6', {OUT => '11'}], @@ -149,8 +154,19 @@ my @Tests = ['fail-c', {ERR => "$prog: missing operand\n" . "Try `$prog --help' for more information.\n"}, {EXIT => 2}], + + ['bignum-add', "$big + 1", {OUT => $big_p1}], + ['bignum-add2', "$big + $big_p1", {OUT => $big_sum}], + ['bignum-sub', "$big_p1 - 1", {OUT => $big}], + ['bignum-sub2', "$big_sum - $big", {OUT => $big_p1}], + ['bignum-mul', "$big_p1 '*' $big", {OUT => $big_prod}], + ['bignum-div', "$big_prod / $big", {OUT => $big_p1}], ); +# If using --bignum fails, remove all /^bignum-/ tests +`expr --bignum 1` + or @Tests = grep {$_->[0] !~ /^bignum-/} @Tests; + # Append a newline to end of each expected `OUT' string. my $t; foreach $t (@Tests) |