Make this test the currently libc-internal isnanl() as well.

While I'm here, turn these into assert(3)-based tests.
This commit is contained in:
kleink 2003-10-24 15:54:46 +00:00
parent 6c2bb73613
commit d805d82f20
2 changed files with 11 additions and 7 deletions

View File

@ -1,9 +1,13 @@
# $NetBSD: Makefile,v 1.3 2002/09/18 05:41:39 lukem Exp $
# $NetBSD: Makefile,v 1.4 2003/10/24 15:54:46 kleink Exp $
NOMAN= # defined
PROG= nan
# the next two lines are required for _isnanl(), which is internal to libc
CPPFLAGS+= -I${NETBSDSRCDIR}/lib/libc/include
CPPFLAGS+= -D_LIBC
regress: ${PROG}
./${PROG}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nan.c,v 1.2 2003/10/22 23:57:04 kleink Exp $ */
/* $NetBSD: nan.c,v 1.3 2003/10/24 15:54:46 kleink Exp $ */
/*
* This file is in the Public Domain.
@ -10,19 +10,19 @@
/*
* Check that NAN (alias __nanf) really is not-a-number.
* Alternatively, check that isnan() minimally works.
* Alternatively, check that isnan() and _isnanl() minimally work.
*/
#include <err.h>
#include "namespace.h"
#include <assert.h>
#include <math.h>
#include <stdlib.h>
int
main(int argc, char **argv)
{
/* NAN is meant to be a NaN. */
if (!isnan(NAN))
errx(1, "NAN is a number");
assert(isnan(NAN));
assert(_isnanl(NAN));
return 0;
}