Add a printf regression test; for now covering lib/32951.

This commit is contained in:
kleink 2006-02-28 19:30:45 +00:00
parent 11ef0797ab
commit ff12504c9c
3 changed files with 35 additions and 2 deletions

View File

@ -1,5 +1,5 @@
# $NetBSD: Makefile,v 1.1 2003/05/30 12:46:05 simonb Exp $
# $NetBSD: Makefile,v 1.2 2006/02/28 19:30:45 kleink Exp $
SUBDIR+= scanf
SUBDIR+= printf scanf
.include <bsd.subdir.mk>

View File

@ -0,0 +1,11 @@
# $NetBSD: Makefile,v 1.1 2006/02/28 19:30:45 kleink Exp $
NOMAN= # defined
PROG= printf
WARNS?= 4
regress: ${PROG}
./${PROG}
.include <bsd.prog.mk>

View File

@ -0,0 +1,22 @@
/* $NetBSD: printf.c,v 1.1 2006/02/28 19:30:45 kleink Exp $ */
/*
* Written by Klaus Klein <kleink@NetBSD.org>, February 28, 2006.
* Public domain.
*/
#include <assert.h>
#include <stdio.h>
int
main(int argc, char *argv[])
{
char s[2];
/* PR lib/32951: %.0f formats (0.0,0.5] to "0." */
assert(snprintf(s, sizeof(s), "%.0f", 0.1) == 1);
assert(s[0] == '0');
/* assert(s[1] == '\0'); */
return 0;
}