- fixed tests using isinf(); the math.c test checks the dietlibc

implementation of isinf() (which differs between positive and negative
    inf). All other tests use boolean retval only and test for the signess
    of the values
This commit is contained in:
ensc 2008-06-21 14:17:00 +00:00
commit c033735eea

View file

@ -1,6 +1,6 @@
diff -up dietlibc-0.31.20080409/test/getmntent.c.testsuite dietlibc-0.31.20080409/test/getmntent.c
--- dietlibc-0.31.20080409/test/getmntent.c.testsuite 2003-12-15 14:07:42.000000000 +0100
+++ dietlibc-0.31.20080409/test/getmntent.c 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/getmntent.c 2008-04-14 00:41:17.000000000 +0200
@@ -33,10 +33,6 @@ while ((e = getmntent(fstab))) {
printf("closing /etc/fstab\n");
@ -15,7 +15,7 @@ diff -up dietlibc-0.31.20080409/test/getmntent.c.testsuite dietlibc-0.31.2008040
-
diff -up dietlibc-0.31.20080409/test/stdio/tst-fphex.c.testsuite dietlibc-0.31.20080409/test/stdio/tst-fphex.c
--- dietlibc-0.31.20080409/test/stdio/tst-fphex.c.testsuite 2003-12-15 14:07:42.000000000 +0100
+++ dietlibc-0.31.20080409/test/stdio/tst-fphex.c 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/stdio/tst-fphex.c 2008-04-14 00:41:17.000000000 +0200
@@ -37,7 +37,7 @@ int main (int argc, char **argv) {
int n = snprintf (buf, sizeof buf, t->fmt, t->value);
if (n != strlen (t->expect) || strcmp (buf, t->expect) != 0)
@ -25,9 +25,29 @@ diff -up dietlibc-0.31.20080409/test/stdio/tst-fphex.c.testsuite dietlibc-0.31.2
t->fmt, t->expect, strlen (t->expect), buf, n, strlen (buf));
result = 1;
}
diff -up dietlibc-0.31.20080409/test/stdio/tstscanf.c.testsuite dietlibc-0.31.20080409/test/stdio/tstscanf.c
--- dietlibc-0.31.20080409/test/stdio/tstscanf.c.testsuite 2003-12-15 14:07:42.000000000 +0100
+++ dietlibc-0.31.20080409/test/stdio/tstscanf.c 2008-04-14 00:47:36.000000000 +0200
@@ -338,14 +338,14 @@ main (int argc, char **argv)
int res;
res = sscanf ("-InF", "%f", &value);
- if (res != 1 || isinf (value) != -1)
+ if (res != 1 || !isinf (value) || !(value<0))
{
fputs ("test failed!\n", stdout);
result = 1;
}
res = sscanf ("+InfiNiTY", "%f", &value);
- if (res != 1 || isinf (value) != 1)
+ if (res != 1 || !isinf (value) || !(value>0))
{
fputs ("test failed!\n", stdout);
result = 1;
diff -up dietlibc-0.31.20080409/test/byteswap.c.testsuite dietlibc-0.31.20080409/test/byteswap.c
--- dietlibc-0.31.20080409/test/byteswap.c.testsuite 2003-12-15 14:07:42.000000000 +0100
+++ dietlibc-0.31.20080409/test/byteswap.c 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/byteswap.c 2008-04-14 00:41:17.000000000 +0200
@@ -9,12 +9,12 @@ int main() {
snprintf(buf,100,"%x %x", bswap_16(0x1234), bswap_16(0x5678));
assert(strcmp(buf, "3412 7856") == 0);
@ -46,8 +66,8 @@ diff -up dietlibc-0.31.20080409/test/byteswap.c.testsuite dietlibc-0.31.20080409
return 0;
}
diff -up dietlibc-0.31.20080409/test/runtests.sh.testsuite dietlibc-0.31.20080409/test/runtests.sh
--- dietlibc-0.31.20080409/test/runtests.sh.testsuite 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-13 23:51:41.000000000 +0200
--- dietlibc-0.31.20080409/test/runtests.sh.testsuite 2008-04-14 00:41:17.000000000 +0200
+++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-14 00:41:17.000000000 +0200
@@ -1,6 +1,6 @@
SUBDIRS="dirent inet stdio string stdlib time"
@ -58,7 +78,7 @@ diff -up dietlibc-0.31.20080409/test/runtests.sh.testsuite dietlibc-0.31.2008040
PASS="getpass"
diff -up dietlibc-0.31.20080409/test/cycles.c.testsuite dietlibc-0.31.20080409/test/cycles.c
--- dietlibc-0.31.20080409/test/cycles.c.testsuite 2004-08-24 12:10:48.000000000 +0200
+++ dietlibc-0.31.20080409/test/cycles.c 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/cycles.c 2008-04-14 00:41:17.000000000 +0200
@@ -24,7 +24,7 @@ int main(int argc,char* argv[]) {
if (!fork()) { execve(argv[1],argv+1,environ); exit(1); }
wait(0);
@ -70,7 +90,7 @@ diff -up dietlibc-0.31.20080409/test/cycles.c.testsuite dietlibc-0.31.20080409/t
}
diff -up dietlibc-0.31.20080409/test/sysenter.c.testsuite dietlibc-0.31.20080409/test/sysenter.c
--- dietlibc-0.31.20080409/test/sysenter.c.testsuite 2003-12-15 14:07:42.000000000 +0100
+++ dietlibc-0.31.20080409/test/sysenter.c 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/sysenter.c 2008-04-14 00:41:17.000000000 +0200
@@ -11,11 +11,11 @@ int main() {
int i;
for (i=0; environ[i]; ++i) ;
@ -87,8 +107,8 @@ diff -up dietlibc-0.31.20080409/test/sysenter.c.testsuite dietlibc-0.31.20080409
return 0;
}
diff -up dietlibc-0.31.20080409/test/Makefile.testsuite dietlibc-0.31.20080409/test/Makefile
--- dietlibc-0.31.20080409/test/Makefile.testsuite 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/Makefile 2008-04-13 23:51:41.000000000 +0200
--- dietlibc-0.31.20080409/test/Makefile.testsuite 2008-04-14 00:41:17.000000000 +0200
+++ dietlibc-0.31.20080409/test/Makefile 2008-04-14 00:41:17.000000000 +0200
@@ -10,7 +10,7 @@ LCOMPAT=-lcompat
TESTPROGRAMS=adjtime argv asprintf atexit bsearch byteswap calloc confstr cycles empty flush fnmatch \
fputc ftw fwrite getaddrinfo getenv getgrnam gethostbyaddr gethostbyname \
@ -100,7 +120,7 @@ diff -up dietlibc-0.31.20080409/test/Makefile.testsuite dietlibc-0.31.20080409/t
speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr \
diff -up dietlibc-0.31.20080409/test/bsearch.c.testsuite dietlibc-0.31.20080409/test/bsearch.c
--- dietlibc-0.31.20080409/test/bsearch.c.testsuite 2003-12-15 14:07:42.000000000 +0100
+++ dietlibc-0.31.20080409/test/bsearch.c 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/bsearch.c 2008-04-14 00:41:17.000000000 +0200
@@ -35,7 +35,7 @@ int main() {
die("bsearch returned NULL\n");
}
@ -112,7 +132,7 @@ diff -up dietlibc-0.31.20080409/test/bsearch.c.testsuite dietlibc-0.31.20080409/
return 0;
diff -up dietlibc-0.31.20080409/test/printftest.c.testsuite dietlibc-0.31.20080409/test/printftest.c
--- dietlibc-0.31.20080409/test/printftest.c.testsuite 2003-12-15 14:07:42.000000000 +0100
+++ dietlibc-0.31.20080409/test/printftest.c 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/printftest.c 2008-04-14 00:41:17.000000000 +0200
@@ -101,8 +101,8 @@ int main()
printf("#%i#\n",18);
printf("#%d#\n",18);
@ -135,7 +155,7 @@ diff -up dietlibc-0.31.20080409/test/printftest.c.testsuite dietlibc-0.31.200804
snprintf(buf2, sizeof(buf2), "%.999999u", 10));
diff -up dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite dietlibc-0.31.20080409/test/stdlib/tst-malloc.c
--- dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite 2003-12-15 14:07:42.000000000 +0100
+++ dietlibc-0.31.20080409/test/stdlib/tst-malloc.c 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/stdlib/tst-malloc.c 2008-04-14 00:41:17.000000000 +0200
@@ -21,13 +21,15 @@
#include <stdlib.h>
#include <stdio.h>
@ -167,7 +187,7 @@ diff -up dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite dietlibc-0.31
if (p != NULL)
diff -up dietlibc-0.31.20080409/test/stdlib/tst-strtod.c.testsuite dietlibc-0.31.20080409/test/stdlib/tst-strtod.c
--- dietlibc-0.31.20080409/test/stdlib/tst-strtod.c.testsuite 2003-12-15 14:07:42.000000000 +0100
+++ dietlibc-0.31.20080409/test/stdlib/tst-strtod.c 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/stdlib/tst-strtod.c 2008-04-14 00:41:17.000000000 +0200
@@ -149,10 +149,10 @@ main (int argc, char ** argv)
}
@ -183,7 +203,7 @@ diff -up dietlibc-0.31.20080409/test/stdlib/tst-strtod.c.testsuite dietlibc-0.31
diff -up dietlibc-0.31.20080409/test/rand48.c.testsuite dietlibc-0.31.20080409/test/rand48.c
--- dietlibc-0.31.20080409/test/rand48.c.testsuite 2002-05-29 15:20:40.000000000 +0200
+++ dietlibc-0.31.20080409/test/rand48.c 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/rand48.c 2008-04-14 00:41:17.000000000 +0200
@@ -6,16 +6,16 @@ main (void)
{
static unsigned short data[7] = { 1, 2, 3, 4, 5, 6, 7 };
@ -209,7 +229,7 @@ diff -up dietlibc-0.31.20080409/test/rand48.c.testsuite dietlibc-0.31.20080409/t
}
diff -up dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite dietlibc-0.31.20080409/test/time/tst-strftime.c
--- dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite 2003-12-15 14:07:42.000000000 +0100
+++ dietlibc-0.31.20080409/test/time/tst-strftime.c 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/time/tst-strftime.c 2008-04-14 00:41:17.000000000 +0200
@@ -49,18 +49,18 @@ int main (void) {
if (res == 0)
@ -234,7 +254,7 @@ diff -up dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite dietlibc-0.31
}
diff -up dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite dietlibc-0.31.20080409/test/time/tst-strptime.c
--- dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite 2003-12-15 14:07:42.000000000 +0100
+++ dietlibc-0.31.20080409/test/time/tst-strptime.c 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/time/tst-strptime.c 2008-04-14 00:41:17.000000000 +0200
@@ -41,10 +41,12 @@ static const struct
{ "C", "03/03/00", "%D", 5, 62, 2, 3 },
{ "C", "9/9/99", "%x", 4, 251, 8, 9 },
@ -293,7 +313,7 @@ diff -up dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite dietlibc-0.31
result = 1;
diff -up dietlibc-0.31.20080409/test/mktime.c.testsuite dietlibc-0.31.20080409/test/mktime.c
--- dietlibc-0.31.20080409/test/mktime.c.testsuite 2004-03-27 01:47:00.000000000 +0100
+++ dietlibc-0.31.20080409/test/mktime.c 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/mktime.c 2008-04-14 00:41:17.000000000 +0200
@@ -9,15 +9,15 @@ int main() {
t.tm_mday=29;
t.tm_mon=2;
@ -315,7 +335,7 @@ diff -up dietlibc-0.31.20080409/test/mktime.c.testsuite dietlibc-0.31.20080409/t
diff -up dietlibc-0.31.20080409/test/asprintf.c.testsuite dietlibc-0.31.20080409/test/asprintf.c
--- dietlibc-0.31.20080409/test/asprintf.c.testsuite 2003-12-15 14:07:42.000000000 +0100
+++ dietlibc-0.31.20080409/test/asprintf.c 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/asprintf.c 2008-04-14 00:41:17.000000000 +0200
@@ -13,7 +13,7 @@ int main(int argc, char **argv) {
assert(strlen(path) == asprintlen);
@ -327,33 +347,40 @@ diff -up dietlibc-0.31.20080409/test/asprintf.c.testsuite dietlibc-0.31.20080409
diff -up /dev/null dietlibc-0.31.20080409/test/math.c
--- /dev/null 2008-03-18 07:40:22.289057188 +0100
+++ dietlibc-0.31.20080409/test/math.c 2008-04-13 23:51:57.000000000 +0200
@@ -0,0 +1,22 @@
+++ dietlibc-0.31.20080409/test/math.c 2008-04-14 00:46:45.000000000 +0200
@@ -0,0 +1,29 @@
+#include <math.h>
+#include <float.h>
+#include <assert.h>
+
+int main()
+{
+ extern int __isinf(double d);
+ extern int __isnan(double d);
+
+#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))
+ assert(isinf(__builtin_inff())==1);
+ assert(isinf(-__builtin_inff())==-1);
+ assert(__isinf(__builtin_inff()) == +1);
+ assert(__isinf(-__builtin_inff()) == -1);
+
+ assert(isinf(__builtin_inf())==1);
+ assert(isinf(-__builtin_inf())==-1);
+ assert(__isinf(__builtin_inf()) == +1);
+ assert(__isinf(-__builtin_inf()) == -1);
+
+ assert(isnan(__builtin_nan("")));
+ assert(__isnan(__builtin_nan("")));
+#endif
+
+ assert(isinf((DBL_MAX * DBL_MAX))==1);
+ assert(isinf(-(DBL_MAX * DBL_MAX))==-1);
+ //assert(isnan(nan("")));
+ assert(__isinf((DBL_MAX * DBL_MAX)) == +1);
+ assert(__isinf(-(DBL_MAX * DBL_MAX)) == -1);
+
+ return 0;
+ assert(isinf((DBL_MAX * DBL_MAX)));
+ assert(isinf(-(DBL_MAX * DBL_MAX)));
+
+ //assert(isnan(nan("")));
+
+ return 0;
+}
diff -up dietlibc-0.31.20080409/test/speed.c.testsuite dietlibc-0.31.20080409/test/speed.c
--- dietlibc-0.31.20080409/test/speed.c.testsuite 2003-12-15 14:07:42.000000000 +0100
+++ dietlibc-0.31.20080409/test/speed.c 2008-04-13 23:51:41.000000000 +0200
+++ dietlibc-0.31.20080409/test/speed.c 2008-04-14 00:41:17.000000000 +0200
@@ -7,10 +7,10 @@ int main() {
int i;
time_t t;