Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Move duplicate ldexp(3) test out from the tests/libc.
details: https://anonhg.NetBSD.org/src/rev/e8337ff30a4c
branches: trunk
changeset: 769691:e8337ff30a4c
user: jruoho <jruoho%NetBSD.org@localhost>
date: Mon Sep 19 05:40:38 2011 +0000
description:
Move duplicate ldexp(3) test out from the tests/libc.
diffstat:
distrib/sets/lists/tests/mi | 6 +-
tests/lib/libc/gen/Makefile | 4 +-
tests/lib/libc/gen/t_ldexp.c | 210 -------------------------------------------
tests/lib/libm/t_ldexp.c | 184 +++++++++++++++++++++++++++++++++++++-
4 files changed, 185 insertions(+), 219 deletions(-)
diffs (truncated from 481 to 300 lines):
diff -r 49a6bc9a1915 -r e8337ff30a4c distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Mon Sep 19 05:25:50 2011 +0000
+++ b/distrib/sets/lists/tests/mi Mon Sep 19 05:40:38 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.390 2011/09/19 05:25:50 jruoho Exp $
+# $NetBSD: mi,v 1.391 2011/09/19 05:40:39 jruoho Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -364,7 +364,7 @@
./usr/libdata/debug/usr/tests/lib/libc/gen/t_glob.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libc/gen/t_glob_star.debug tests-obsolete obsolete
./usr/libdata/debug/usr/tests/lib/libc/gen/t_humanize_number.debug tests-lib-debug debug,atf
-./usr/libdata/debug/usr/tests/lib/libc/gen/t_ldexp.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/gen/t_ldexp.debug tests-obsolete obsolete
./usr/libdata/debug/usr/tests/lib/libc/gen/t_nice.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libc/gen/t_pause.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libc/gen/t_raise.debug tests-lib-debug debug,atf
@@ -1890,7 +1890,7 @@
./usr/tests/lib/libc/gen/t_glob tests-lib-tests atf
./usr/tests/lib/libc/gen/t_glob_star tests-obsolete obsolete
./usr/tests/lib/libc/gen/t_humanize_number tests-lib-tests atf
-./usr/tests/lib/libc/gen/t_ldexp tests-lib-tests atf
+./usr/tests/lib/libc/gen/t_ldexp tests-obsolete obsolete
./usr/tests/lib/libc/gen/t_nice tests-lib-tests atf
./usr/tests/lib/libc/gen/t_pause tests-lib-tests atf
./usr/tests/lib/libc/gen/t_raise tests-lib-tests atf
diff -r 49a6bc9a1915 -r e8337ff30a4c tests/lib/libc/gen/Makefile
--- a/tests/lib/libc/gen/Makefile Mon Sep 19 05:25:50 2011 +0000
+++ b/tests/lib/libc/gen/Makefile Mon Sep 19 05:40:38 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.29 2011/09/19 05:25:50 jruoho Exp $
+# $NetBSD: Makefile,v 1.30 2011/09/19 05:40:38 jruoho Exp $
.include <bsd.own.mk>
@@ -18,7 +18,6 @@
TESTS_C+= t_glob
TESTS_C+= t_humanize_number
TESTS_C+= t_isnan
-TESTS_C+= t_ldexp
TESTS_C+= t_nice
TESTS_C+= t_pause
TESTS_C+= t_raise
@@ -31,7 +30,6 @@
TESTS_C+= t_vis
LDADD.t_fpclassify+= -lm
-LDADD.t_ldexp+= -lm
LDADD.t_nice+= -lpthread
LDADD.t_syslog+= -lpthread
diff -r 49a6bc9a1915 -r e8337ff30a4c tests/lib/libc/gen/t_ldexp.c
--- a/tests/lib/libc/gen/t_ldexp.c Mon Sep 19 05:25:50 2011 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,210 +0,0 @@
-/* $NetBSD: t_ldexp.c,v 1.5 2011/04/07 18:14:08 jruoho Exp $ */
-
-/*-
- * Copyright (c) 2010 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <atf-c.h>
-#include <atf-c/config.h>
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define SKIP 9999
-#define FORMAT "%23.23lg"
-
-struct ldexp_test {
- double x;
- int exp1;
- int exp2;
- const char *result;
-};
-
-struct ldexp_test basics[] = {
- { 1.0, 5, SKIP, " 32" },
- { 1.0, 1022, SKIP, "4.4942328371557897693233e+307" },
- { 1.0, 1023, -1, "4.4942328371557897693233e+307" },
- { 1.0, 1023, SKIP, "8.9884656743115795386465e+307" },
- { 1.0, 1022, 1, "8.9884656743115795386465e+307" },
- { 1.0, -1022, 2045, "8.9884656743115795386465e+307" },
- { 1.0, -5, SKIP, " 0.03125" },
- { 1.0, -1021, SKIP, "4.4501477170144027661805e-308" },
- { 1.0, -1022, 1, "4.4501477170144027661805e-308" },
- { 1.0, -1022, SKIP, "2.2250738585072013830902e-308" },
- { 1.0, -1021, -1, "2.2250738585072013830902e-308" },
- { 1.0, 1023, -2045, "2.2250738585072013830902e-308" },
- { 1.0, 1023, -1023, " 1" },
- { 1.0, -1022, 1022, " 1" },
- { 0, 0, 0, NULL }
-};
-
-struct ldexp_test zero[] = {
- { 0.0, -1, SKIP, " 0" },
- { 0.0, 0, SKIP, " 0" },
- { 0.0, 1, SKIP, " 0" },
- { 0.0, 1024, SKIP, " 0" },
- { 0.0, 1025, SKIP, " 0" },
- { 0.0, -1023, SKIP, " 0" },
- { 0.0, -1024, SKIP, " 0" },
- { 0, 0, 0, NULL }
-};
-
-struct ldexp_test infinity[] = {
- { 1.0, 1024, -1, " inf" },
- { 1.0, 1024, 0, " inf" },
- { 1.0, 1024, 1, " inf" },
- { -1.0, 1024, -1, " -inf" },
- { -1.0, 1024, 0, " -inf" },
- { -1.0, 1024, 1, " -inf" },
- { 0, 0, 0, NULL }
-};
-
-struct ldexp_test overflow[] = {
- { 1.0, 1024, SKIP, " inf" },
- { 1.0, 1023, 1, " inf" },
- { 1.0, -1022, 2046, " inf" },
- { 1.0, 1025, SKIP, " inf" },
- { -1.0, 1024, SKIP, " -inf" },
- { -1.0, 1023, 1, " -inf" },
- { -1.0, -1022, 2046, " -inf" },
- { -1.0, 1025, SKIP, " -inf" },
- { 0, 0, 0, NULL }
-};
-
-struct ldexp_test denormal[] = {
- { 1.0, -1023, SKIP, "1.1125369292536006915451e-308" },
- { 1.0, -1022, -1, "1.1125369292536006915451e-308" },
- { 1.0, 1023, -2046, "1.1125369292536006915451e-308" },
- { 1.0, -1024, SKIP, "5.5626846462680034577256e-309" },
- { 1.0, -1074, SKIP, "4.9406564584124654417657e-324" },
- { -1.0, -1023, SKIP, "-1.1125369292536006915451e-308" },
- { -1.0, -1022, -1, "-1.1125369292536006915451e-308" },
- { -1.0, 1023, -2046, "-1.1125369292536006915451e-308" },
- { -1.0, -1024, SKIP, "-5.5626846462680034577256e-309" },
- { -1.0, -1074, SKIP, "-4.9406564584124654417657e-324" },
- { 0, 0, 0, NULL }
-};
-
-struct ldexp_test underflow[] = {
- { 1.0, -1075, SKIP, " 0" },
- { 1.0, -1074, -1, " 0" },
- { 1.0, 1023, -2098, " 0" },
- { 1.0, -1076, SKIP, " 0" },
- { -1.0, -1075, SKIP, " -0" },
- { -1.0, -1074, -1, " -0" },
- { -1.0, 1023, -2098, " -0" },
- { -1.0, -1076, SKIP, " -0" },
- { 0, 0, 0, NULL }
-};
-
-struct ldexp_test denormal_large_exp[] = {
- { 1.0, -1028, 1024, " 0.0625" },
- { 1.0, -1028, 1025, " 0.125" },
- { 1.0, -1028, 1026, " 0.25" },
- { 1.0, -1028, 1027, " 0.5" },
- { 1.0, -1028, 1028, " 1" },
- { 1.0, -1028, 1029, " 2" },
- { 1.0, -1028, 1030, " 4" },
- { 1.0, -1028, 1040, " 4096" },
- { 1.0, -1028, 1050, " 4194304" },
- { 1.0, -1028, 1060, " 4294967296" },
- { 1.0, -1028, 1100, " 4722366482869645213696" },
- { 1.0, -1028, 1200, "5.9863107065073783529623e+51" },
- { 1.0, -1028, 1300, "7.5885503602567541832791e+81" },
- { 1.0, -1028, 1400, "9.6196304190416209014353e+111" },
- { 1.0, -1028, 1500, "1.2194330274671844653834e+142" },
- { 1.0, -1028, 1600, "1.5458150092069033378781e+172" },
- { 1.0, -1028, 1700, "1.9595533242629369747791e+202" },
- { 1.0, -1028, 1800, "2.4840289476811342962384e+232" },
- { 1.0, -1028, 1900, "3.1488807865122869393369e+262" },
- { 1.0, -1028, 2000, "3.9916806190694396233127e+292" },
- { 1.0, -1028, 2046, "2.808895523222368605827e+306" },
- { 1.0, -1028, 2047, "5.6177910464447372116541e+306" },
- { 1.0, -1028, 2048, "1.1235582092889474423308e+307" },
- { 1.0, -1028, 2049, "2.2471164185778948846616e+307" },
- { 1.0, -1028, 2050, "4.4942328371557897693233e+307" },
- { 1.0, -1028, 2051, "8.9884656743115795386465e+307" },
- { 0, 0, 0, NULL }
-};
-
-static void
-run_test(struct ldexp_test *table)
-{
- int i;
- double v;
- char outbuf[64];
-
- for (i = 0; table->result != NULL; table++, i++) {
- v = ldexp(table->x, table->exp1);
- if (table->exp2 != SKIP)
- v = ldexp(v, table->exp2);
- snprintf(outbuf, sizeof(outbuf), FORMAT, v);
- ATF_CHECK_STREQ_MSG(table->result, outbuf,
- "Entry %d:\n\tExp: \"%s\"\n\tAct: \"%s\"",
- i, table->result, outbuf);
- }
-}
-
-#define TEST(name) \
- ATF_TC(name); \
- ATF_TC_HEAD(name, tc) \
- { \
- \
- atf_tc_set_md_var(tc, "descr", \
- "Test ldexp(3) for " ___STRING(name)); \
- } \
- ATF_TC_BODY(name, tc) \
- { \
- const char *machine; \
- \
- machine = atf_config_get("atf_machine"); \
- if (strcmp("vax", machine) == 0) \
- atf_tc_skip("Test not valid for %s", machine); \
- run_test(name); \
- }
-
-TEST(basics)
-TEST(zero)
-TEST(infinity)
-TEST(overflow)
-TEST(denormal)
-TEST(underflow)
-TEST(denormal_large_exp)
-
-ATF_TP_ADD_TCS(tp)
-{
-
- ATF_TP_ADD_TC(tp, basics);
- ATF_TP_ADD_TC(tp, zero);
- ATF_TP_ADD_TC(tp, infinity);
- ATF_TP_ADD_TC(tp, overflow);
- ATF_TP_ADD_TC(tp, denormal);
- ATF_TP_ADD_TC(tp, underflow);
- ATF_TP_ADD_TC(tp, denormal_large_exp);
-
- return atf_no_error();
-}
diff -r 49a6bc9a1915 -r e8337ff30a4c tests/lib/libm/t_ldexp.c
--- a/tests/lib/libm/t_ldexp.c Mon Sep 19 05:25:50 2011 +0000
+++ b/tests/lib/libm/t_ldexp.c Mon Sep 19 05:40:38 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ldexp.c,v 1.9 2011/09/17 06:21:19 jruoho Exp $ */
+/* $NetBSD: t_ldexp.c,v 1.10 2011/09/19 05:40:38 jruoho Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,15 +29,159 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ldexp.c,v 1.9 2011/09/17 06:21:19 jruoho Exp $");
+__RCSID("$NetBSD: t_ldexp.c,v 1.10 2011/09/19 05:40:38 jruoho Exp $");
+
+#include <atf-c.h>
+#include <atf-c/config.h>
#include <math.h>
#include <limits.h>
+#include <stdio.h>
+#include <string.h>
-#include <atf-c.h>
+#define SKIP 9999
+#define FORMAT "%23.23lg"
static const int exps[] = { 0, 1, -1, 100, -100 };
+struct ldexp_test {
+ double x;
+ int exp1;
+ int exp2;
Home |
Main Index |
Thread Index |
Old Index