Try to maintain the structure of libc and move 't_strtox' to 't_strtod'.
This commit is contained in:
parent
13f6fd89a7
commit
1cd1da49e9
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: mi,v 1.292 2011/04/05 06:15:30 jruoho Exp $
|
||||
# $NetBSD: mi,v 1.293 2011/04/05 08:24:28 jruoho Exp $
|
||||
#
|
||||
# Note: don't delete entries from here - mark them as "obsolete" instead.
|
||||
#
|
||||
|
@ -410,7 +410,7 @@
|
|||
./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_mi_vector_hash.debug tests-lib-debug debug,atf
|
||||
./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_posix_memalign.debug tests-lib-debug debug,atf
|
||||
./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_strtod.debug tests-lib-debug debug,atf
|
||||
./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_strtox.debug tests-lib-debug debug,atf
|
||||
./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_strtox.debug tests-obsolete obsolete
|
||||
./usr/libdata/debug/usr/tests/lib/libc/string tests-lib-debug
|
||||
./usr/libdata/debug/usr/tests/lib/libc/string/t_memcpy.debug tests-lib-debug debug,atf
|
||||
./usr/libdata/debug/usr/tests/lib/libc/string/t_memmem.debug tests-lib-debug debug,atf
|
||||
|
@ -1866,7 +1866,7 @@
|
|||
./usr/tests/lib/libc/stdlib/t_mi_vector_hash tests-lib-tests atf
|
||||
./usr/tests/lib/libc/stdlib/t_posix_memalign tests-lib-tests atf
|
||||
./usr/tests/lib/libc/stdlib/t_strtod tests-lib-tests atf
|
||||
./usr/tests/lib/libc/stdlib/t_strtox tests-lib-tests atf
|
||||
./usr/tests/lib/libc/stdlib/t_strtox tests-obsolete obsolete
|
||||
./usr/tests/lib/libc/string tests-lib-tests
|
||||
./usr/tests/lib/libc/string/Atffile tests-lib-tests atf
|
||||
./usr/tests/lib/libc/string/t_memcpy tests-lib-tests atf
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.10 2011/04/05 06:15:30 jruoho Exp $
|
||||
# $NetBSD: Makefile,v 1.11 2011/04/05 08:24:28 jruoho Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
|
@ -11,7 +11,6 @@ TESTS_C+= t_hsearch
|
|||
TESTS_C+= t_mi_vector_hash
|
||||
TESTS_C+= t_posix_memalign
|
||||
TESTS_C+= t_strtod
|
||||
TESTS_C+= t_strtox
|
||||
|
||||
TESTS_SH+= t_atexit
|
||||
TESTS_SH+= t_getopt
|
||||
|
@ -23,6 +22,7 @@ BINDIR= ${TESTSDIR}
|
|||
PROGS+= h_atexit
|
||||
PROGS+= h_getopt h_getopt_long
|
||||
|
||||
LDADD.t_strtod= -lm
|
||||
LDADD.t_environment_pth= -pthread
|
||||
|
||||
.include <bsd.test.mk>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: t_strtod.c,v 1.1 2011/04/05 06:15:30 jruoho Exp $ */
|
||||
/* $NetBSD: t_strtod.c,v 1.2 2011/04/05 08:24:28 jruoho Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2011 The NetBSD Foundation, Inc.
|
||||
|
@ -32,10 +32,11 @@
|
|||
/* Public domain, Otto Moerbeek <otto@drijf.net>, 2006. */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_strtod.c,v 1.1 2011/04/05 06:15:30 jruoho Exp $");
|
||||
__RCSID("$NetBSD: t_strtod.c,v 1.2 2011/04/05 08:24:28 jruoho Exp $");
|
||||
|
||||
#include <atf-c.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -66,6 +67,33 @@ ATF_TC_BODY(strtod_basic, tc)
|
|||
}
|
||||
}
|
||||
|
||||
ATF_TC(strtod_hex);
|
||||
ATF_TC_HEAD(strtod_hex, tc)
|
||||
{
|
||||
atf_tc_set_md_var(tc, "descr", "A strtod(3) with hexadecimals");
|
||||
}
|
||||
|
||||
ATF_TC_BODY(strtod_hex, tc)
|
||||
{
|
||||
const char *str;
|
||||
char *end;
|
||||
double d;
|
||||
|
||||
str = "-0x0";
|
||||
d = strtod(str, &end); /* -0.0 */
|
||||
|
||||
ATF_REQUIRE(end == str + 4);
|
||||
ATF_REQUIRE(signbit(d) != 0);
|
||||
ATF_REQUIRE(fabs(d) < 1.0e-40);
|
||||
|
||||
str = "-0x";
|
||||
d = strtod(str, &end); /* -0.0 */
|
||||
|
||||
ATF_REQUIRE(end == str + 2);
|
||||
ATF_REQUIRE(signbit(d) != 0);
|
||||
ATF_REQUIRE(fabs(d) < 1.0e-40);
|
||||
}
|
||||
|
||||
ATF_TC(strtod_underflow);
|
||||
ATF_TC_HEAD(strtod_underflow, tc)
|
||||
{
|
||||
|
@ -98,6 +126,7 @@ ATF_TP_ADD_TCS(tp)
|
|||
{
|
||||
|
||||
ATF_TP_ADD_TC(tp, strtod_basic);
|
||||
ATF_TP_ADD_TC(tp, strtod_hex);
|
||||
ATF_TP_ADD_TC(tp, strtod_underflow);
|
||||
|
||||
return atf_no_error();
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
/* $NetBSD: t_strtox.c,v 1.3 2011/03/22 22:29:18 njoly 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 COPYRIGHT HOLDERS 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
|
||||
* COPYRIGHT HOLDERS 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 <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_strtox.c,v 1.3 2011/03/22 22:29:18 njoly Exp $");
|
||||
|
||||
#include <atf-c.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
ATF_TC(hexadecimal);
|
||||
|
||||
ATF_TC_HEAD(hexadecimal, tc)
|
||||
{
|
||||
atf_tc_set_md_var(tc, "descr",
|
||||
"Test strtod with hexdecimal numbers");
|
||||
}
|
||||
|
||||
ATF_TC_BODY(hexadecimal, tc)
|
||||
{
|
||||
const char *str;
|
||||
char *end;
|
||||
|
||||
str = "-0x0";
|
||||
ATF_REQUIRE(strtod(str, &end) == -0.0 && end == str+4);
|
||||
|
||||
str = "-0x";
|
||||
ATF_REQUIRE(strtod(str, &end) == -0.0 && end == str+2);
|
||||
}
|
||||
|
||||
ATF_TP_ADD_TCS(tp)
|
||||
{
|
||||
ATF_TP_ADD_TC(tp, hexadecimal);
|
||||
|
||||
return atf_no_error();
|
||||
}
|
Loading…
Reference in New Issue