Module Name:    src
Committed By:   jruoho
Date:           Sat Jun  4 10:16:59 UTC 2011

Modified Files:
        src/tests/lib/libc/stdlib: t_strtod.c

Log Message:
Add more strings to the "infinity test".


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/lib/libc/stdlib/t_strtod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/stdlib/t_strtod.c
diff -u src/tests/lib/libc/stdlib/t_strtod.c:1.13 src/tests/lib/libc/stdlib/t_strtod.c:1.14
--- src/tests/lib/libc/stdlib/t_strtod.c:1.13	Sat Jun  4 09:57:33 2011
+++ src/tests/lib/libc/stdlib/t_strtod.c	Sat Jun  4 10:16:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_strtod.c,v 1.13 2011/06/04 09:57:33 jruoho Exp $ */
+/*	$NetBSD: t_strtod.c,v 1.14 2011/06/04 10:16:59 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 /* Public domain, Otto Moerbeek <o...@drijf.net>, 2006. */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_strtod.c,v 1.13 2011/06/04 09:57:33 jruoho Exp $");
+__RCSID("$NetBSD: t_strtod.c,v 1.14 2011/06/04 10:16:59 jruoho Exp $");
 
 #include <errno.h>
 #include <math.h>
@@ -108,11 +108,17 @@
 
 ATF_TC_BODY(strtod_inf, tc)
 {
+
 #ifndef __vax__
 
+	static const char *str[] =
+	    { "Inf", "INF", "-Inf", "-INF", "Infinity", "+Infinity",
+	      "INFINITY", "-INFINITY", "InFiNiTy", "+InFiNiTy" };
+
 	long double ld;
 	double d;
 	float f;
+	size_t i;
 
 	/*
 	 * See the closed PR lib/33262.
@@ -122,14 +128,17 @@
 	if (system("cpuctl identify 0 | grep -q QEMU") == 0)
 		atf_tc_expect_fail("PR misc/44767");
 
-	d = strtod("INF", NULL);
-	ATF_REQUIRE(isinf(d) != 0);
+	for (i = 0; i < __arraycount(str); i++) {
 
-	f = strtof("INF", NULL);
-	ATF_REQUIRE(isinff(f) != 0);
+		d = strtod(str[i], NULL);
+		ATF_REQUIRE(isinf(d) != 0);
 
-	ld = strtold("INF", NULL);
-	ATF_REQUIRE(isinf(ld) != 0);
+		f = strtof(str[i], NULL);
+		ATF_REQUIRE(isinf(f) != 0);
+
+		ld = strtold(str[i], NULL);
+		ATF_REQUIRE(isinf(ld) != 0);
+	}
 #endif
 }
 

Reply via email to