Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/gen Add basic fpsetmask test to exercize sett...
details: https://anonhg.NetBSD.org/src/rev/4c1d79372cd0
branches: trunk
changeset: 770515:4c1d79372cd0
user: njoly <njoly%NetBSD.org@localhost>
date: Wed Oct 19 15:27:16 2011 +0000
description:
Add basic fpsetmask test to exercize setting/clearing bits.
diffstat:
tests/lib/libc/gen/t_fpsetmask.c | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
diffs (45 lines):
diff -r 66e4d00e7792 -r 4c1d79372cd0 tests/lib/libc/gen/t_fpsetmask.c
--- a/tests/lib/libc/gen/t_fpsetmask.c Wed Oct 19 15:24:58 2011 +0000
+++ b/tests/lib/libc/gen/t_fpsetmask.c Wed Oct 19 15:27:16 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fpsetmask.c,v 1.2 2011/10/01 17:46:10 christos Exp $ */
+/* $NetBSD: t_fpsetmask.c,v 1.3 2011/10/19 15:27:16 njoly Exp $ */
/*-
* Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -310,6 +310,27 @@
TEST(fpsetmask_unmasked, double)
TEST(fpsetmask_unmasked, long_double)
+ATF_TC(fpsetmask_basic);
+ATF_TC_HEAD(fpsetmask_basic, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "A basic test of fpsetmask(3)");
+}
+
+ATF_TC_BODY(fpsetmask_basic, tc)
+{
+ size_t i;
+ fp_except_t msk, lst[] = { FP_X_INV, FP_X_DZ, FP_X_OFL, FP_X_UFL };
+
+ msk = fpgetmask();
+ for (i = 0; i < __arraycount(lst); i++) {
+ fpsetmask(msk | lst[i]);
+ ATF_CHECK((fpgetmask() & lst[i]) != 0);
+ fpsetmask(msk & lst[i]);
+ ATF_CHECK((fpgetmask() & lst[i]) == 0);
+ }
+
+}
+
#endif /* defined(_FLOAT_IEEE754) */
ATF_TP_ADD_TCS(tp)
@@ -318,6 +339,7 @@
#ifndef _FLOAT_IEEE754
ATF_TP_ADD_TC(tp, no_test);
#else
+ ATF_TP_ADD_TC(tp, fpsetmask_basic);
ATF_TP_ADD_TC(tp, fpsetmask_masked_float);
ATF_TP_ADD_TC(tp, fpsetmask_masked_double);
ATF_TP_ADD_TC(tp, fpsetmask_masked_long_double);
Home |
Main Index |
Thread Index |
Old Index