Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Move the only regress/lib/libm test to the new atf format



details:   https://anonhg.NetBSD.org/src/rev/e515e55a0a55
branches:  trunk
changeset: 759931:e515e55a0a55
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Mon Dec 20 23:47:23 2010 +0000

description:
Move the only regress/lib/libm test to the new atf format

diffstat:

 distrib/sets/lists/tests/mi |   6 +++++-
 etc/mtree/NetBSD.dist.tests |   4 +++-
 tests/lib/Makefile          |   6 +++---
 tests/lib/libm/Makefile     |  11 +++++++++++
 tests/lib/libm/t_libm.c     |  44 ++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 66 insertions(+), 5 deletions(-)

diffs (131 lines):

diff -r 566f9943dce8 -r e515e55a0a55 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Mon Dec 20 21:18:45 2010 +0000
+++ b/distrib/sets/lists/tests/mi       Mon Dec 20 23:47:23 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.183 2010/12/20 16:23:01 njoly Exp $
+# $NetBSD: mi,v 1.184 2010/12/20 23:47:23 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -339,6 +339,7 @@
 ./usr/libdata/debug/usr/tests/lib/semaphore/pthread/t_sem_pth.debug    tests-lib-debug         debug,atf
 ./usr/libdata/debug/usr/tests/lib/libevent                             tests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libevent/h_event.debug               tests-lib-debug         debug,atf
+./usr/libdata/debug/usr/tests/lib/libm                                 tests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libobjc                              tests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libobjc/t_threads.debug              tests-lib-debug         debug,atf
 ./usr/libdata/debug/usr/tests/lib/libposix                             tests-lib-debug
@@ -1561,6 +1562,9 @@
 ./usr/tests/lib/libevent/Atffile               tests-lib-tests         atf
 ./usr/tests/lib/libevent/h_event               tests-lib-tests         atf
 ./usr/tests/lib/libevent/t_event               tests-lib-tests         atf
+./usr/tests/lib/libm                           tests-lib-tests         atf
+./usr/tests/lib/libm/Atffile                   tests-lib-tests         atf
+./usr/tests/lib/libm/t_libm                    tests-lib-tests         atf
 ./usr/tests/lib/libobjc                                tests-lib-tests         atf
 ./usr/tests/lib/libobjc/Atffile                        tests-lib-tests         atf
 ./usr/tests/lib/libobjc/t_threads              tests-lib-tests         atf
diff -r 566f9943dce8 -r e515e55a0a55 etc/mtree/NetBSD.dist.tests
--- a/etc/mtree/NetBSD.dist.tests       Mon Dec 20 21:18:45 2010 +0000
+++ b/etc/mtree/NetBSD.dist.tests       Mon Dec 20 23:47:23 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: NetBSD.dist.tests,v 1.5 2010/12/15 20:42:23 pooka Exp $
+#      $NetBSD: NetBSD.dist.tests,v 1.6 2010/12/20 23:47:23 pgoyette Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -53,6 +53,7 @@
 ./usr/libdata/debug/usr/tests/lib/libevent
 ./usr/libdata/debug/usr/tests/lib/semaphore
 ./usr/libdata/debug/usr/tests/lib/semaphore/pthread
+./usr/libdata/debug/usr/tests/lib/libm
 ./usr/libdata/debug/usr/tests/lib/libobjc
 ./usr/libdata/debug/usr/tests/lib/libposix
 ./usr/libdata/debug/usr/tests/lib/libposix/bsd
@@ -144,6 +145,7 @@
 ./usr/tests/lib/semaphore
 ./usr/tests/lib/semaphore/pthread
 ./usr/tests/lib/libevent
+./usr/tests/lib/libm
 ./usr/tests/lib/libobjc
 ./usr/tests/lib/libposix
 ./usr/tests/lib/libposix/bsd
diff -r 566f9943dce8 -r e515e55a0a55 tests/lib/Makefile
--- a/tests/lib/Makefile        Mon Dec 20 21:18:45 2010 +0000
+++ b/tests/lib/Makefile        Mon Dec 20 23:47:23 2010 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.9 2010/08/25 16:46:36 jmmv Exp $
+# $NetBSD: Makefile,v 1.10 2010/12/20 23:47:23 pgoyette Exp $
 
 .include <bsd.own.mk>
 
-TESTS_SUBDIRS= csu libc libevent libobjc libposix libprop librt libpthread \
-               libutil semaphore
+TESTS_SUBDIRS= csu libc libm libevent libobjc libposix libprop librt \
+               libpthread libutil semaphore
 
 .if ${MKCRYPTO} != "no"
 TESTS_SUBDIRS+= libdes
diff -r 566f9943dce8 -r e515e55a0a55 tests/lib/libm/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libm/Makefile   Mon Dec 20 23:47:23 2010 +0000
@@ -0,0 +1,11 @@
+# $NetBSD: Makefile,v 1.1 2010/12/20 23:47:23 pgoyette Exp $
+
+.include <bsd.own.mk>
+
+TESTSDIR=      ${TESTSBASE}/lib/libm
+
+TESTS_C+=      t_libm
+
+LDADD+=-lm
+
+.include <bsd.test.mk>
diff -r 566f9943dce8 -r e515e55a0a55 tests/lib/libm/t_libm.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libm/t_libm.c   Mon Dec 20 23:47:23 2010 +0000
@@ -0,0 +1,44 @@
+/* $NetBSD: t_libm.c,v 1.1 2010/12/20 23:47:23 pgoyette Exp $ */
+
+#include <atf-c.h>
+#include <math.h>
+
+/*
+ * This tests for a bug in the initial implementation where precision
+ * was lost in an internal substraction, leading to rounding
+ * into the wrong direction.
+ */
+
+ATF_TC(round);
+
+/* 0.5 - EPSILON */
+#define VAL 0x0.7ffffffffffffcp0
+#define VALF 0x0.7fffff8p0
+
+ATF_TC_HEAD(round, tc)
+{
+       atf_tc_set_md_var(tc, "descr", "Check for rounding in wrong direction");
+}
+
+ATF_TC_BODY(round, tc)
+{
+       double a = VAL, b, c;
+       float af = VALF, bf, cf;
+
+       b = round(a);
+       bf = roundf(af);
+       c = round(-a);
+       cf = roundf(-af);
+       ATF_REQUIRE(b == 0);
+       ATF_REQUIRE(bf == 0);
+       ATF_REQUIRE(c == 0);
+       ATF_REQUIRE(cf == 0);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+       ATF_TP_ADD_TC(tp, round);
+
+       return atf_no_error();
+}



Home | Main Index | Thread Index | Old Index