This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Initialize x in frexp, modf, remqou tests
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Mon, 6 May 2013 15:03:04 +0000
- Subject: Initialize x in frexp, modf, remqou tests
The tests in libm-test.inc that check the value of signgam initialize
it to 0 before each test (gen-libm-test.pl has special code to do
so). The tests of libm functions that check values output through
pointers do not initialize the variables before testing, but it's more
robust to do so to detect any cases where the function fails to set an
output through the pointer at all, and being more consistent here also
helps in the conversion to data-driven tests. This patch adds
appropriate initializers for those tests. Tested x86_64.
2013-05-06 Joseph Myers <joseph@codesourcery.com>
* math/gen-libm-test.pl (parse_args): Initialize x before each
test of frexp, modf and remquo.
diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl
index a743797..2f93898 100755
--- a/math/gen-libm-test.pl
+++ b/math/gen-libm-test.pl
@@ -366,6 +366,7 @@ sub parse_args {
# special treatment for some functions
if ($args[0] eq 'frexp') {
+ $pre = " x = 123456789;\n";
if (defined $special[0] && $special[0] ne "IGNORE") {
my ($str) = "$call sets x to $special[0]";
$post = " check_int (\"$str\", x, $special[0]";
@@ -379,12 +380,14 @@ sub parse_args {
$post .= &new_test ($str, undef);
}
} elsif ($args[0] eq 'modf') {
+ $pre = " x = 123.456789;\n";
if (defined $special[0] && $special[0] ne "IGNORE") {
my ($str) = "$call sets x to $special[0]";
$post = " check_float (\"$str\", x, $special[0]";
$post .= &new_test ($str, undef);
}
} elsif ($args[0] eq 'remquo') {
+ $pre = " x = 123456789;\n";
if (defined $special[0] && $special[0] ne "IGNORE") {
my ($str) = "$call sets x to $special[0]";
$post = " check_int (\"$str\", x, $special[0]";
--
Joseph S. Myers
joseph@codesourcery.com