Module Name:    src
Committed By:   njoly
Date:           Tue Jun 14 11:58:22 UTC 2011

Modified Files:
        src/tests/lib/libc: t_convfp.c

Log Message:
Move unsigned int/long conversion test to their own testcases, to
avoid having the whole marked as skipped. While here update testcases
names.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/t_convfp.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/t_convfp.c
diff -u src/tests/lib/libc/t_convfp.c:1.6 src/tests/lib/libc/t_convfp.c:1.7
--- src/tests/lib/libc/t_convfp.c:1.6	Sat Jun 11 18:03:18 2011
+++ src/tests/lib/libc/t_convfp.c	Tue Jun 14 11:58:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_convfp.c,v 1.6 2011/06/11 18:03:18 christos Exp $	*/
+/*	$NetBSD: t_convfp.c,v 1.7 2011/06/14 11:58:22 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -43,19 +43,16 @@
 #define ULONG_TESTVALUE	(LONG_MAX+42UL)
 
 
-ATF_TC(test1);
-
-ATF_TC_HEAD(test1, tc)
+ATF_TC(conv_uint);
+ATF_TC_HEAD(conv_uint, tc)
 {
 
-	atf_tc_set_md_var(tc, "descr", "test conversions to unsigned int/long");
+	atf_tc_set_md_var(tc, "descr", "test conversions to unsigned int");
 }
 
-ATF_TC_BODY(test1, tc)
+ATF_TC_BODY(conv_uint, tc)
 {
 	unsigned int ui;
-	unsigned long ul;
-	long double dt;
 	double d;
 
 	/* unsigned int test */
@@ -65,6 +62,21 @@
 	if (ui != UINT_TESTVALUE)
 		atf_tc_fail("FAILED: unsigned int %u (0x%x) != %u (0x%x)",
 		    ui, ui, UINT_TESTVALUE, UINT_TESTVALUE);
+}
+
+ATF_TC(conv_ulong);
+
+ATF_TC_HEAD(conv_ulong, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr", "test conversions to unsigned long");
+}
+
+ATF_TC_BODY(conv_ulong, tc)
+{
+	unsigned long ul;
+	long double dt;
+	double d;
 
 	/* unsigned long vs. {long} double test */
 	if (sizeof(d) > sizeof(ul)) {
@@ -79,8 +91,7 @@
 		printf("sizeof(long) = %zu, sizeof(double) = %zu, "
 		    "sizeof(long double) = %zu\n", 
 		    sizeof(ul), sizeof(d), sizeof(dt));
-		atf_tc_skip("no suitable {long} double type found, skipping "
-		    "\"unsigned long\" test");
+		atf_tc_skip("no suitable {long} double type found");
 	}
 
 	if (ul != ULONG_TESTVALUE)
@@ -88,15 +99,15 @@
 		    ul, ul, ULONG_TESTVALUE, ULONG_TESTVALUE);
 }
 
-ATF_TC(test2);
+ATF_TC(cast_ulong);
 
-ATF_TC_HEAD(test2, tc)
+ATF_TC_HEAD(cast_ulong, tc)
 {
 
 	atf_tc_set_md_var(tc, "descr", "test double to unsigned long cast");
 }
 
-ATF_TC_BODY(test2, tc)
+ATF_TC_BODY(cast_ulong, tc)
 {
 	double nv;
 	unsigned long uv;
@@ -104,30 +115,30 @@
 	nv = 5.6;
 	uv = (unsigned long)nv;
 
-	ATF_REQUIRE_EQ_MSG(uv, 5,
+	ATF_CHECK_EQ_MSG(uv, 5,
 	    "%.3f casted to unsigned long is %lu", nv, uv);
 }
 
-ATF_TC(test3);
+ATF_TC(cast_ulong2);
 
-ATF_TC_HEAD(test3, tc)
+ATF_TC_HEAD(cast_ulong2, tc)
 {
 
 	atf_tc_set_md_var(tc, "descr",
 	    "test double/long double casts to unsigned long");
 }
 
-ATF_TC_BODY(test3, tc)
+ATF_TC_BODY(cast_ulong2, tc)
 {
 	double dv = 1.9;
 	long double ldv = dv;
 	unsigned long l1 = dv;
 	unsigned long l2 = ldv;
 
-	ATF_REQUIRE_EQ_MSG(l1, 1,
+	ATF_CHECK_EQ_MSG(l1, 1,
 	    "double 1.9 casted to unsigned long should be 1, but is %lu", l1);
 
-	ATF_REQUIRE_EQ_MSG(l2, 1,
+	ATF_CHECK_EQ_MSG(l2, 1,
 	    "long double 1.9 casted to unsigned long should be 1, but is %lu",
 	    l2);
 }
@@ -135,9 +146,10 @@
 ATF_TP_ADD_TCS(tp)
 {
 
-	ATF_TP_ADD_TC(tp, test1);
-	ATF_TP_ADD_TC(tp, test2);
-	ATF_TP_ADD_TC(tp, test3);
+	ATF_TP_ADD_TC(tp, conv_uint);
+	ATF_TP_ADD_TC(tp, conv_ulong);
+	ATF_TP_ADD_TC(tp, cast_ulong);
+	ATF_TP_ADD_TC(tp, cast_ulong2);
 
 	return atf_no_error();
 }

Reply via email to